rtppassthrough

package
v0.26.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Overview

Package rtppassthrough defines a source of RTP packets

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQueueFull indicates the StreamSubscription's queue is full and that
	// the callback passed to Publish will not be executed.
	ErrQueueFull = errors.New("StreamSubscription Publish queue full")
	// ErrClosed indicates the StreamSubscription's is not running.
	ErrClosed = errors.New("StreamSubscription has been closed")
	// ErrNegativeQueueSize indicates that the StreamSubscription queueSize
	// can't be less than 0.
	ErrNegativeQueueSize = errors.New("StreamSubscription queue size can't be negative")
)

Functions

This section is empty.

Types

type PacketCallback

type PacketCallback func(pkts []*rtp.Packet) error

PacketCallback is the signature of the SubscribeRTP callback.

type Source

type Source interface {
	SubscribeRTP(ctx context.Context, bufferSize int, packetsCB PacketCallback) (SubscriptionID, error)
	Unsubscribe(ctx context.Context, id SubscriptionID) error
}

Source is a source of video codec data.

type StreamSubscription

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

StreamSubscription 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 NewStreamSubscription

func NewStreamSubscription(queueSize int, onError func(error)) (*StreamSubscription, error)

NewStreamSubscription allocates an rtp passthrough stream subscription.

func (*StreamSubscription) Close

func (w *StreamSubscription) Close()

Close closes the subscription routine.

func (*StreamSubscription) ID

func (w *StreamSubscription) ID() uuid.UUID

ID returns the id of the StreamSubscription.

func (*StreamSubscription) Publish

func (w *StreamSubscription) Publish(cb func() error) error

Publish publishes the callback to the subscriber If there are too many queued messages return an error and does not publish.

func (*StreamSubscription) Start

func (w *StreamSubscription) Start()

Start starts the subscription routine.

type SubscriptionID

type SubscriptionID = uuid.UUID

SubscriptionID is the id of a StreamSubscription.

Jump to

Keyboard shortcuts

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