webstream

package
v0.27.1 Latest Latest
Warning

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

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

Documentation

Overview

Package webstream provides controls for streaming from the web server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamAudioSource added in v0.0.8

func StreamAudioSource(
	ctx context.Context,
	source gostream.AudioSource,
	stream gostream.Stream,
	backoffOpts *BackoffTuningOptions,
	logger logging.Logger,
) error

StreamAudioSource starts a stream from an audio source with a throttled error handler.

func StreamVideoSource added in v0.0.8

func StreamVideoSource(
	ctx context.Context,
	source gostream.VideoSource,
	stream gostream.Stream,
	backoffOpts *BackoffTuningOptions,
	logger logging.Logger,
) error

StreamVideoSource starts a stream from a video source with a throttled error handler.

Types

type BackoffTuningOptions

type BackoffTuningOptions struct {
	// BaseSleep sets the initial amount of time to wait after an error.
	BaseSleep time.Duration
	// MaxSleep determines the maximum amount of time that streamSource is
	// permitted to a sleep after receiving a single error.
	MaxSleep time.Duration
	// Cooldown sets how long since the last error that we can reset our backoff. This
	// should be greater than MaxSleep. This prevents a scenario where we haven't made
	// a call to read for a long time and the error may go away sooner.
	Cooldown time.Duration
}

BackoffTuningOptions represents a set of parameters for determining exponential backoff when receiving multiple simultaneous errors.

BaseSleep is the duration to wait after receiving a new error. After that, the wait time doubles for every subsequent, consecutive error of the same type, until the wait duration reaches the MaxSleep duration.

func (*BackoffTuningOptions) GetSleepTimeFromErrorCount

func (opts *BackoffTuningOptions) GetSleepTimeFromErrorCount(errorCount int) time.Duration

GetSleepTimeFromErrorCount returns a sleep time from an error count.

type Server added in v0.24.0

type Server struct {
	streampb.UnimplementedStreamServiceServer
	// contains filtered or unexported fields
}

Server implements the gRPC audio/video streaming service.

func NewServer added in v0.24.0

func NewServer(
	streams []gostream.Stream,
	r robot.Robot,
	logger logging.Logger,
) (*Server, error)

NewServer returns a server that will run on the given port and initially starts with the given stream.

func (*Server) AddStream added in v0.24.0

AddStream implements part of the StreamServiceServer.

func (*Server) Close added in v0.24.0

func (ss *Server) Close() error

Close closes the Server and waits for spun off goroutines to complete.

func (*Server) ListStreams added in v0.24.0

ListStreams implements part of the StreamServiceServer.

func (*Server) NewStream added in v0.24.0

func (ss *Server) NewStream(config gostream.StreamConfig) (gostream.Stream, error)

NewStream informs the stream server of new streams that are capable of being streamed.

func (*Server) RemoveStream added in v0.24.0

RemoveStream implements part of the StreamServiceServer.

type StreamAlreadyRegisteredError added in v0.24.0

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

StreamAlreadyRegisteredError indicates that a stream has a name that is already registered on the stream server.

func (*StreamAlreadyRegisteredError) Error added in v0.24.0

Directories

Path Synopsis
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.
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.

Jump to

Keyboard shortcuts

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