state

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

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

View Source
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

func New(
	stream gostream.Stream,
	r robot.Robot,
	logger logging.Logger,
) *StreamState

New returns a new *StreamState. rtpPassthroughSource is allowed to be nil if the camere does not implement rtppassthrough.Source.

func (*StreamState) Close

func (ss *StreamState) Close() error

Close closes the StreamState.

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.

Jump to

Keyboard shortcuts

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