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 (ss *Server) AddStream(ctx context.Context, req *streampb.AddStreamRequest) (*streampb.AddStreamResponse, error)
- func (ss *Server) Close() error
- func (ss *Server) ListStreams(ctx context.Context, req *streampb.ListStreamsRequest) (*streampb.ListStreamsResponse, error)
- func (ss *Server) NewStream(config gostream.StreamConfig) (gostream.Stream, error)
- func (ss *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 (ss *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 (ss *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 (ss *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