Documentation ¶
Overview ¶
Package rtppassthrough defines a Source of RTP packets
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrQueueFull indicates the Buffer's queue is full and that // the callback passed to Publish will not be executed. ErrQueueFull = errors.New("Buffer Publish queue full") // ErrClosed indicates the Buffer is not running. ErrClosed = errors.New("Buffer has been closed") // ErrBufferSize indicates that the Buffer size // can't be less than 0. ErrBufferSize = errors.New("Buffer size can't be negative") )
var NilSubscription = Subscription{ID: uuid.Nil}
NilSubscription is the value of a nil Subscription.
Functions ¶
func NewSubscription ¶ added in v0.27.0
func NewSubscription(size int) (Subscription, *Buffer, error)
NewSubscription allocates an rtppassthrough *Buffer and a Subscription. The *Buffer is intended to be used by the rtppassthrough.Source implemnter. The Subscription is intended to be returned to the SubscribeRTP caller (aka the subscriber). When the Subscription has terminated, the rtppassthrough.Source implemnter should call Close() on the *Buffer to notify the subscriber that the subscription has terminated.
Types ¶
type Buffer ¶ added in v0.27.0
type Buffer struct {
// contains filtered or unexported fields
}
Buffer executes the callbacks sent to Publish in a single goroutine & drops Publish callbacks if the buffer is full. This is desirable behavior for streaming protocols where dropping stale packets is desirable to minimize latency.
func (*Buffer) Close ¶ added in v0.27.0
func (w *Buffer) Close()
Close closes the buffer goroutine and terminates the Subscription.
type PacketCallback ¶
PacketCallback is the signature of the SubscribeRTP callback.
type Source ¶
type Source interface { // SubscribeRTP begins a subscription to receive RTP packets. // When the Subscription terminates the context in the returned Subscription // is cancelled SubscribeRTP(ctx context.Context, bufferSize int, packetsCB PacketCallback) (Subscription, error) // Unsubscribe terminates the subscription with the provided SubscriptionID. Unsubscribe(ctx context.Context, id SubscriptionID) error }
Source is a source of video codec data.
type Subscription ¶ added in v0.27.0
type Subscription struct { // ID is the ID of the Subscription ID SubscriptionID // The Terminated context will be cancelled when the RTP Subscription has terminated. // A successful call to Unsubscribe terminates the RTP Subscription with that ID // An RTP Subscription may also terminate for other internal to the Source // (IO errors, reconfiguration, etc) Terminated context.Context }
Subscription is the return value of a call to SubscribeRTP.