Documentation ¶
Overview ¶
Package webstream provides controls for streaming from the web server.
Index ¶
- func StreamAudioSource(ctx context.Context, source gostream.AudioSource, stream gostream.Stream, ...) error
- func StreamVideoSource(ctx context.Context, source gostream.VideoSource, stream gostream.Stream, ...) error
- type BackoffTuningOptions
- type Server
- func (server *Server) AddStream(ctx context.Context, req *streampb.AddStreamRequest) (*streampb.AddStreamResponse, error)
- func (server *Server) Close() error
- func (server *Server) ListStreams(ctx context.Context, req *streampb.ListStreamsRequest) (*streampb.ListStreamsResponse, error)
- func (server *Server) NewStream(config gostream.StreamConfig) (gostream.Stream, error)
- func (server *Server) RemoveStream(ctx context.Context, req *streampb.RemoveStreamRequest) (*streampb.RemoveStreamResponse, error)
- type StreamAlreadyRegisteredError
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
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
func (server *Server) AddStream(ctx context.Context, req *streampb.AddStreamRequest) (*streampb.AddStreamResponse, error)
AddStream implements part of the StreamServiceServer.
func (*Server) Close ¶ added in v0.24.0
Close closes the Server and waits for spun off goroutines to complete.
func (*Server) ListStreams ¶ added in v0.24.0
func (server *Server) ListStreams(ctx context.Context, req *streampb.ListStreamsRequest) (*streampb.ListStreamsResponse, error)
ListStreams implements part of the StreamServiceServer.
func (*Server) NewStream ¶ added in v0.24.0
NewStream informs the stream server of new streams that are capable of being streamed.
func (*Server) RemoveStream ¶ added in v0.24.0
func (server *Server) RemoveStream(ctx context.Context, req *streampb.RemoveStreamRequest) (*streampb.RemoveStreamResponse, error)
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
func (e *StreamAlreadyRegisteredError) Error() string
Directories ¶
Path | Synopsis |
---|---|
Package camera provides functions for looking up a camera from a robot using a stream
|
Package camera provides functions for looking up a camera from a robot using a stream |
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. |