publisher

package
v0.0.0-...-3f3c78e Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSubscriptionExists = errors.New("subscription already exists")

Functions

This section is empty.

Types

type Publisher

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

An abstract publisher that reads the packets from the track and forwards them to all subscribers.

func NewPublisher

func NewPublisher(
	track Track,
	stop <-chan struct{},
	considerStalledAfter time.Duration,
	log *logrus.Entry,
) (*Publisher, <-chan Status)

Starts a new publisher, returns a publisher along with the channel that informs the caller about the status update of the publisher (i.e. stalled, or active). Once the channel is closed, the publisher can be considered stopped.

func (*Publisher) AddSubscription

func (p *Publisher) AddSubscription(subscription Subscription)

func (*Publisher) GetTrack

func (p *Publisher) GetTrack() Track

func (*Publisher) IsStalled

func (p *Publisher) IsStalled() bool

func (*Publisher) RemoveSubscription

func (p *Publisher) RemoveSubscription(subscription Subscription)

func (*Publisher) RemoveSubscriptions

func (p *Publisher) RemoveSubscriptions() []Subscription

func (*Publisher) ReplaceTrack

func (p *Publisher) ReplaceTrack(track Track)

type RemoteTrack

type RemoteTrack struct {
	// The underlying `webrtc.TrackRemote`.
	Track *webrtc.TrackRemote
}

Wrapper for the `webrtc.TrackRemote`.

func (*RemoteTrack) ReadPacket

func (t *RemoteTrack) ReadPacket() (*rtp.Packet, error)

Implement the `Track` interface for the `webrtc.TrackRemote`.

type Status

type Status int
const (
	StatusStalled Status = iota + 1
	StatusRecovered
)

type Subscription

type Subscription interface {
	// WriteRTP **must not** block (wait on I/O).
	WriteRTP(packet rtp.Packet) error
}

type Track

type Track interface {
	// ReadPacket **may** block (wait on I/O).
	ReadPacket() (*rtp.Packet, error)
}

Jump to

Keyboard shortcuts

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