Documentation ¶
Overview ¶
Package state controls the source of the RTP packets being written to the stream's subscribers and ensures there is only one active at a time while there are peer connections to receive RTP packets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // UnsubscribeTimeout is the timeout used when unsubscribing from an rtppassthrough subscription. UnsubscribeTimeout = time.Second * 5 // ErrRTPPassthroughNotSupported indicates that rtp_passthrough is not supported by the stream's camera. ErrRTPPassthroughNotSupported = errors.New("RTP Passthrough Not Supported") // ErrClosed indicates that the StreamState is already closed. ErrClosed = errors.New("StreamState already closed") // ErrUninitialized indicates that Init() has not been called on StreamState prior to Increment or Decrement being called. ErrUninitialized = errors.New("uniniialized") )
Functions ¶
This section is empty.
Types ¶
type StreamState ¶
type StreamState struct { // Stream is the StreamState's stream Stream gostream.Stream // contains filtered or unexported fields }
StreamState controls the source of the RTP packets being written to the stream's subscribers and ensures there is only one active at a time while there are subsribers.
func New ¶
New returns a new *StreamState. rtpPassthroughSource is allowed to be nil if the camere does not implement rtppassthrough.Source.
func (*StreamState) Decrement ¶
func (ss *StreamState) Decrement(ctx context.Context) error
Decrement decrements the peer connections subscribed to the stream.
func (*StreamState) Increment ¶
func (ss *StreamState) Increment(ctx context.Context) error
Increment increments the peer connections subscribed to the stream.
func (*StreamState) Init ¶
func (ss *StreamState) Init()
Init initializes the StreamState Init must be called before any other methods.
func (*StreamState) Restart ¶
func (ss *StreamState) Restart(ctx context.Context)
Restart restarts the stream source after it has terminated.