scream

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2022 License: BSD-2-Clause Imports: 3 Imported by: 4

README

scream-go

Go Reference

scream-go is a CGO-wrapper for the SCReAM-implementation by EricssonResearch.

SCReAM is a mobile optimised congestion control algorithm for realtime interactive media.

Installation

go get github.com/mengelbart/scream-go

LICENSES

The files taken from the Ericsson Research's SCReAM-implementation are licensed under the LICENSE in LICENSE_SCREAM. Anything added to that implementation is LICENSED under a BSD 2-Clause License in the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RTPQueue

type RTPQueue interface {
	// SizeOfNextRTP returns the size of the next item in the queue.
	SizeOfNextRTP() int

	// SeqNrOfNextRTP returns the RTP sequence number of the next item in the queue
	SeqNrOfNextRTP() uint16

	// SeqNrOfLastRTP returns the RTP sequence number of the last item in the queue
	SeqNrOfLastRTP() uint16

	// BytesInQueue returns the total number of bytes in the queue, i.e. the
	// sum of the sizes of all items in the queue.
	BytesInQueue() int

	// SizeOfQueue returns the number of items in the queue.
	SizeOfQueue() int

	// GetDelay returns the delay of the last item in the queue.
	// ts is given in seconds.
	GetDelay(ts float64) float64

	// GetSizeOfLastFrame returns the size of the latest pushed item.
	GetSizeOfLastFrame() int

	// Clear empties the queue.
	Clear() int
}

RTPQueue implements a simple RTP packet queue. One RTPQueue should be used per SSRC stream.

type Rx

type Rx struct {
	// contains filtered or unexported fields
}

Rx implements the receiver side of SCReAM

func NewRx

func NewRx(ssrc uint32) *Rx

NewRx creates a new Rx instance. One Rx is created for each source SSRC

func (*Rx) CreateStandardizedFeedback

func (r *Rx) CreateStandardizedFeedback(ntpTime uint64, isMark bool) (bool, []byte)

CreateStandardizedFeedback creates a feedback packet according to https://tools.ietf.org/wg/avtcore/draft-ietf-avtcore-cc-feedback-message/ Current implementation implements -02 version It is up to the wrapper application to prepend this RTCP with SR or RR when needed

func (*Rx) IsFeedback

func (r *Rx) IsFeedback(ntpTime uint64) bool

IsFeedback returns TRUE if an RTP packet has been received and there is pending feedback

func (*Rx) Receive

func (r *Rx) Receive(ntpTime uint64, ssrc uint32, size int, seqNr uint16, ceBits uint8)

Receive needs to be called each time an RTP packet is received

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

Tx implements the sender side of SCReAM

func NewTx

func NewTx() *Tx

NewTx creates a new Tx instance.

func (*Tx) AddTransmitted

func (t *Tx) AddTransmitted(ntpTime uint64, ssrc uint32, size int, seqNr uint16, isMark bool) float64

AddTransmitted adds a packet to list of transmitted packets. Should be called when an RTP packet was transmitted. AddTransmitted returns the time until IsOkToTransmit can be called again.

func (*Tx) GetStatistics

func (t *Tx) GetStatistics(ntpTime uint64, clear bool) string

GetStatistics returns some overall SCReAM statistics.

func (*Tx) GetTargetBitrate

func (t *Tx) GetTargetBitrate(ssrc uint32) float64

GetTargetBitrate returns the target bitrate for the stream with ssrc. NOTE!, Because SCReAM operates on RTP packets, the target bitrate will also include the RTP overhead. This means that a subsequent call to set the media coder target bitrate must subtract an estimate of the RTP + framing overhead. This is not critical for Video bitrates but can be important when SCReAM is used to congestion control e.g low bitrate audio streams.

Function returns -1 if a loss is detected, this signal can be used to request a new key frame from a video encoder.

func (*Tx) IncomingStandardizedFeedback

func (t *Tx) IncomingStandardizedFeedback(ntpTime uint64, buf []byte)

IncomingStandardizedFeedback parses an incoming standardized feedback according to https://tools.ietf.org/wg/avtcore/draft-ietf-avtcore-cc-feedback-message/ Current implementation implements -02 version and assumes that SR/RR or other non-CC feedback is stripped.

func (*Tx) IsOkToTransmit

func (t *Tx) IsOkToTransmit(ntpTime uint64, ssrc uint32) float64

IsOkToTransmit determines if an RTP packet with ssrc can be transmitted. Returns:

0.0: RTP packet with ssrc can be immediately transmitted. AddTransmitted must be called if packet is transmitted as a result of this.

>0.0: Time [s] until this function should be called again. This can be used to start a timer. Note that a call to NewMediaFrame or IncomingFeedback should cause an immediate call to isOkToTransmit.

-1.0: No RTP packet available to transmit or send window is not large enough

func (*Tx) NewMediaFrame

func (t *Tx) NewMediaFrame(ntpTime uint64, ssrc uint32, bytesRTP int)

NewMediaFrame should be called for each new video frame. IsOkToTransmit should be called after newMediaFrame

func (*Tx) RegisterNewStream

func (t *Tx) RegisterNewStream(rtpQueue RTPQueue, ssrc uint32, priority, minBitrate, startBitrate, maxBitrate float64)

RegisterNewStream registers a new stream with ssrc using rtpQueue. Priority is in the range ]0.0..1.0] where 1.0 denotes the highest priority. It is recommended that at least one stream has priority 1.0. Bitrates are specified in bps

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL