Documentation ¶
Overview ¶
Package cc implements an interceptor for bandwidth estimation that can be used with different BandwidthEstimators.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BandwidthEstimator ¶
type BandwidthEstimator interface { AddStream(*interceptor.StreamInfo, interceptor.RTPWriter) interceptor.RTPWriter WriteRTCP([]rtcp.Packet, interceptor.Attributes) error GetTargetBitrate() int OnTargetBitrateChange(f func(bitrate int)) GetStats() map[string]interface{} Close() error }
BandwidthEstimator is the interface that will be returned by a NewPeerConnectionCallback and can be used to query current bandwidth metrics and add feedback manually.
type BandwidthEstimatorFactory ¶
type BandwidthEstimatorFactory func() (BandwidthEstimator, error)
BandwidthEstimatorFactory creates new BandwidthEstimators
type Interceptor ¶
type Interceptor struct { interceptor.NoOp // contains filtered or unexported fields }
Interceptor implements Google Congestion Control
func (*Interceptor) BindLocalStream ¶
func (c *Interceptor) BindLocalStream(info *interceptor.StreamInfo, writer interceptor.RTPWriter) interceptor.RTPWriter
BindLocalStream lets you modify any outgoing RTP packets. It is called once for per LocalStream. The returned method will be called once per rtp packet.
func (*Interceptor) BindRTCPReader ¶
func (c *Interceptor) BindRTCPReader(reader interceptor.RTCPReader) interceptor.RTCPReader
BindRTCPReader lets you modify any incoming RTCP packets. It is called once per sender/receiver, however this might change in the future. The returned method will be called once per packet batch.
func (*Interceptor) Close ¶
func (c *Interceptor) Close() error
Close closes the interceptor and the associated bandwidth estimator.
type InterceptorFactory ¶
type InterceptorFactory struct {
// contains filtered or unexported fields
}
InterceptorFactory is a factory for CC interceptors
func NewInterceptor ¶
func NewInterceptor(factory BandwidthEstimatorFactory, opts ...Option) (*InterceptorFactory, error)
NewInterceptor returns a new CC interceptor factory
func (*InterceptorFactory) NewInterceptor ¶
func (f *InterceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error)
NewInterceptor returns a new CC interceptor
func (*InterceptorFactory) OnNewPeerConnection ¶
func (f *InterceptorFactory) OnNewPeerConnection(cb NewPeerConnectionCallback)
OnNewPeerConnection sets a callback that is called when a new CC interceptor is created.
type NewPeerConnectionCallback ¶
type NewPeerConnectionCallback func(id string, estimator BandwidthEstimator)
NewPeerConnectionCallback returns the BandwidthEstimator for the PeerConnection with id
type Option ¶
type Option func(*Interceptor) error
Option can be used to set initial options on CC interceptors