Documentation
¶
Index ¶
- Constants
- Variables
- type AddTrackParams
- type Event
- type MaxDistanceSorter
- type MinDistanceSorter
- type ProbeMode
- type StreamAllocator
- func (s *StreamAllocator) AddTrack(downTrack *sfu.DownTrack, params AddTrackParams)
- func (s *StreamAllocator) IsBWEEnabled(downTrack *sfu.DownTrack) bool
- func (s *StreamAllocator) IsSubscribeMutable(downTrack *sfu.DownTrack) bool
- func (s *StreamAllocator) OnAvailableLayersChanged(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnBitrateAvailabilityChanged(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnCongestionStateChange(fromState bwe.CongestionState, toState bwe.CongestionState, ...)
- func (s *StreamAllocator) OnMaxPublishedSpatialChanged(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnMaxPublishedTemporalChanged(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnPacerProbeObserverClusterComplete(probeClusterId ccutils.ProbeClusterId)
- func (s *StreamAllocator) OnProbeClusterSwitch(pci ccutils.ProbeClusterInfo)
- func (s *StreamAllocator) OnREMB(downTrack *sfu.DownTrack, remb *rtcp.ReceiverEstimatedMaximumBitrate)
- func (s *StreamAllocator) OnResume(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnSendProbe(bytesToSend int)
- func (s *StreamAllocator) OnStreamStateChange(f func(update *StreamStateUpdate) error)
- func (s *StreamAllocator) OnSubscribedLayerChanged(downTrack *sfu.DownTrack, layer buffer.VideoLayer)
- func (s *StreamAllocator) OnSubscriptionChanged(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) OnTransportCCFeedback(downTrack *sfu.DownTrack, fb *rtcp.TransportLayerCC)
- func (s *StreamAllocator) RemoveTrack(downTrack *sfu.DownTrack)
- func (s *StreamAllocator) SetAllowPause(allowPause bool)
- func (s *StreamAllocator) SetChannelCapacity(channelCapacity int64)
- func (s *StreamAllocator) SetSendSideBWEInterceptor(sendSideBWEInterceptor cc.BandwidthEstimator)
- func (s *StreamAllocator) SetTrackPriority(downTrack *sfu.DownTrack, priority uint8)
- func (s *StreamAllocator) Start()
- func (s *StreamAllocator) Stop()
- type StreamAllocatorConfig
- type StreamAllocatorParams
- type StreamState
- type StreamStateInfo
- type StreamStateUpdate
- type Track
- func (t *Track) AllocateNextHigher(availableChannelCapacity int64, allowOvershoot bool) (sfu.VideoAllocation, bool)
- func (t *Track) AllocateOptimal(allowOvershoot bool, hold bool) sfu.VideoAllocation
- func (t *Track) BandwidthRequested() int64
- func (t *Track) DistanceToDesired() float64
- func (t *Track) DownTrack() *sfu.DownTrack
- func (t *Track) GetNackDelta() (uint32, uint32)
- func (t *Track) GetNextHigherTransition(allowOvershoot bool) (sfu.VideoTransition, bool)
- func (t *Track) ID() livekit.TrackID
- func (t *Track) IsDeficient() bool
- func (t *Track) IsManaged() bool
- func (t *Track) IsSubscribeMutable() bool
- func (t *Track) Pause() sfu.VideoAllocation
- func (t *Track) Priority() uint8
- func (t *Track) ProvisionalAllocate(availableChannelCapacity int64, layer buffer.VideoLayer, allowPause bool, ...) (bool, int64)
- func (t *Track) ProvisionalAllocateCommit() sfu.VideoAllocation
- func (t *Track) ProvisionalAllocateGetBestWeightedTransition() sfu.VideoTransition
- func (t *Track) ProvisionalAllocateGetCooperativeTransition(allowOvershoot bool) sfu.VideoTransition
- func (t *Track) ProvisionalAllocatePrepare()
- func (t *Track) ProvisionalAllocateReset()
- func (t *Track) PublisherID() livekit.ParticipantID
- func (t *Track) SetDirty(isDirty bool) bool
- func (t *Track) SetMaxLayer(layer buffer.VideoLayer) bool
- func (t *Track) SetPriority(priority uint8) bool
- func (t *Track) SetStreamState(streamState StreamState) bool
- func (t *Track) WritePaddingRTP(bytesToSend int) int
- func (t *Track) WriteProbePackets(bytesToSend int) int
- type TrackSorter
Constants ¶
const ( ChannelCapacityInfinity = 100 * 1000 * 1000 // 100 Mbps PriorityMin = uint8(1) PriorityMax = uint8(255) PriorityDefaultVideo = PriorityMin FlagAllowOvershootWhileOptimal = true FlagAllowOvershootWhileDeficient = false FlagAllowOvershootExemptTrackWhileDeficient = true FlagAllowOvershootInProbe = true FlagAllowOvershootInCatchup = false FlagAllowOvershootInBoost = true )
Variables ¶
var ( DefaultStreamAllocatorConfig = StreamAllocatorConfig{ MinChannelCapacity: 0, DisableEstimationUnmanagedTracks: false, ProbeMode: ProbeModePadding, ProbeOveragePct: 120, ProbeMinBps: 200_000, PausedMinWait: 5 * time.Second, } )
Functions ¶
This section is empty.
Types ¶
type AddTrackParams ¶
type AddTrackParams struct {
Source livekit.TrackSource
Priority uint8
IsSimulcast bool
PublisherID livekit.ParticipantID
}
type Event ¶
type Event struct {
*StreamAllocator
Signal streamAllocatorSignal
TrackID livekit.TrackID
Data interface{}
}
type MaxDistanceSorter ¶
type MaxDistanceSorter []*Track
func (MaxDistanceSorter) Len ¶
func (m MaxDistanceSorter) Len() int
func (MaxDistanceSorter) Less ¶
func (m MaxDistanceSorter) Less(i, j int) bool
func (MaxDistanceSorter) Swap ¶
func (m MaxDistanceSorter) Swap(i, j int)
type MinDistanceSorter ¶
type MinDistanceSorter []*Track
func (MinDistanceSorter) Len ¶
func (m MinDistanceSorter) Len() int
func (MinDistanceSorter) Less ¶
func (m MinDistanceSorter) Less(i, j int) bool
func (MinDistanceSorter) Swap ¶
func (m MinDistanceSorter) Swap(i, j int)
type StreamAllocator ¶
type StreamAllocator struct {
// contains filtered or unexported fields
}
func NewStreamAllocator ¶
func NewStreamAllocator(params StreamAllocatorParams, enabled bool, allowPause bool) *StreamAllocator
func (*StreamAllocator) AddTrack ¶
func (s *StreamAllocator) AddTrack(downTrack *sfu.DownTrack, params AddTrackParams)
func (*StreamAllocator) IsBWEEnabled ¶ added in v1.5.0
func (s *StreamAllocator) IsBWEEnabled(downTrack *sfu.DownTrack) bool
called to check if track should participate in BWE
func (*StreamAllocator) IsSubscribeMutable ¶ added in v1.5.0
func (s *StreamAllocator) IsSubscribeMutable(downTrack *sfu.DownTrack) bool
called to check if track subscription mute can be applied
func (*StreamAllocator) OnAvailableLayersChanged ¶
func (s *StreamAllocator) OnAvailableLayersChanged(downTrack *sfu.DownTrack)
called when feeding track's layer availability changes
func (*StreamAllocator) OnBitrateAvailabilityChanged ¶
func (s *StreamAllocator) OnBitrateAvailabilityChanged(downTrack *sfu.DownTrack)
called when feeding track's bitrate measurement of any layer is available
func (*StreamAllocator) OnCongestionStateChange ¶ added in v1.8.1
func (s *StreamAllocator) OnCongestionStateChange(fromState bwe.CongestionState, toState bwe.CongestionState, estimatedAvailableChannelCapacity int64)
BWEListener implementation
func (*StreamAllocator) OnMaxPublishedSpatialChanged ¶ added in v1.4.2
func (s *StreamAllocator) OnMaxPublishedSpatialChanged(downTrack *sfu.DownTrack)
called when feeding track's max published spatial layer changes
func (*StreamAllocator) OnMaxPublishedTemporalChanged ¶ added in v1.4.2
func (s *StreamAllocator) OnMaxPublishedTemporalChanged(downTrack *sfu.DownTrack)
called when feeding track's max published temporal layer changes
func (*StreamAllocator) OnPacerProbeObserverClusterComplete ¶ added in v1.8.1
func (s *StreamAllocator) OnPacerProbeObserverClusterComplete(probeClusterId ccutils.ProbeClusterId)
called when pacer probe observer observes a cluster completion
func (*StreamAllocator) OnProbeClusterSwitch ¶ added in v1.8.1
func (s *StreamAllocator) OnProbeClusterSwitch(pci ccutils.ProbeClusterInfo)
called when probe cluster changes
func (*StreamAllocator) OnREMB ¶
func (s *StreamAllocator) OnREMB(downTrack *sfu.DownTrack, remb *rtcp.ReceiverEstimatedMaximumBitrate)
called when a new REMB is received (receive side bandwidth estimation)
func (*StreamAllocator) OnResume ¶ added in v1.4.2
func (s *StreamAllocator) OnResume(downTrack *sfu.DownTrack)
called when forwarder resumes a track
func (*StreamAllocator) OnSendProbe ¶
func (s *StreamAllocator) OnSendProbe(bytesToSend int)
called when prober wants to send packet(s)
func (*StreamAllocator) OnStreamStateChange ¶
func (s *StreamAllocator) OnStreamStateChange(f func(update *StreamStateUpdate) error)
func (*StreamAllocator) OnSubscribedLayerChanged ¶ added in v1.4.2
func (s *StreamAllocator) OnSubscribedLayerChanged(downTrack *sfu.DownTrack, layer buffer.VideoLayer)
called when subscribed layer changes (limiting max layer)
func (*StreamAllocator) OnSubscriptionChanged ¶
func (s *StreamAllocator) OnSubscriptionChanged(downTrack *sfu.DownTrack)
called when subscription settings changes (muting/unmuting of track)
func (*StreamAllocator) OnTransportCCFeedback ¶
func (s *StreamAllocator) OnTransportCCFeedback(downTrack *sfu.DownTrack, fb *rtcp.TransportLayerCC)
called when a new transport-cc feedback is received
func (*StreamAllocator) RemoveTrack ¶
func (s *StreamAllocator) RemoveTrack(downTrack *sfu.DownTrack)
func (*StreamAllocator) SetAllowPause ¶ added in v1.4.2
func (s *StreamAllocator) SetAllowPause(allowPause bool)
func (*StreamAllocator) SetChannelCapacity ¶ added in v1.4.2
func (s *StreamAllocator) SetChannelCapacity(channelCapacity int64)
func (*StreamAllocator) SetSendSideBWEInterceptor ¶ added in v1.8.1
func (s *StreamAllocator) SetSendSideBWEInterceptor(sendSideBWEInterceptor cc.BandwidthEstimator)
func (*StreamAllocator) SetTrackPriority ¶
func (s *StreamAllocator) SetTrackPriority(downTrack *sfu.DownTrack, priority uint8)
func (*StreamAllocator) Start ¶
func (s *StreamAllocator) Start()
func (*StreamAllocator) Stop ¶
func (s *StreamAllocator) Stop()
type StreamAllocatorConfig ¶ added in v1.8.1
type StreamAllocatorConfig struct {
MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"`
DisableEstimationUnmanagedTracks bool `yaml:"disable_etimation_unmanaged_tracks,omitempty"`
ProbeMode ProbeMode `yaml:"probe_mode,omitempty"`
ProbeOveragePct int64 `yaml:"probe_overage_pct,omitempty"`
ProbeMinBps int64 `yaml:"probe_min_bps,omitempty"`
PausedMinWait time.Duration `yaml:"paused_min_wait,omitempty"`
}
type StreamAllocatorParams ¶
type StreamState ¶
type StreamState int
const ( StreamStateInactive StreamState = iota StreamStateActive StreamStatePaused )
func (StreamState) String ¶
func (s StreamState) String() string
type StreamStateInfo ¶
type StreamStateInfo struct {
ParticipantID livekit.ParticipantID
TrackID livekit.TrackID
State StreamState
}
type StreamStateUpdate ¶
type StreamStateUpdate struct {
StreamStates []*StreamStateInfo
}
func NewStreamStateUpdate ¶
func NewStreamStateUpdate() *StreamStateUpdate
func (*StreamStateUpdate) Empty ¶
func (s *StreamStateUpdate) Empty() bool
func (*StreamStateUpdate) HandleStreamingChange ¶
func (s *StreamStateUpdate) HandleStreamingChange(track *Track, streamState StreamState)
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
func NewTrack ¶
func NewTrack( downTrack *sfu.DownTrack, source livekit.TrackSource, isSimulcast bool, publisherID livekit.ParticipantID, logger logger.Logger, ) *Track
func (*Track) AllocateNextHigher ¶
func (*Track) AllocateOptimal ¶
func (t *Track) AllocateOptimal(allowOvershoot bool, hold bool) sfu.VideoAllocation
func (*Track) BandwidthRequested ¶
func (*Track) DistanceToDesired ¶
func (*Track) GetNackDelta ¶
func (*Track) GetNextHigherTransition ¶
func (t *Track) GetNextHigherTransition(allowOvershoot bool) (sfu.VideoTransition, bool)
func (*Track) IsDeficient ¶
func (*Track) IsSubscribeMutable ¶ added in v1.5.0
func (*Track) Pause ¶
func (t *Track) Pause() sfu.VideoAllocation
func (*Track) ProvisionalAllocate ¶
func (*Track) ProvisionalAllocateCommit ¶
func (t *Track) ProvisionalAllocateCommit() sfu.VideoAllocation
func (*Track) ProvisionalAllocateGetBestWeightedTransition ¶
func (t *Track) ProvisionalAllocateGetBestWeightedTransition() sfu.VideoTransition
func (*Track) ProvisionalAllocateGetCooperativeTransition ¶
func (t *Track) ProvisionalAllocateGetCooperativeTransition(allowOvershoot bool) sfu.VideoTransition
func (*Track) ProvisionalAllocatePrepare ¶
func (t *Track) ProvisionalAllocatePrepare()
func (*Track) ProvisionalAllocateReset ¶ added in v1.4.5
func (t *Track) ProvisionalAllocateReset()
func (*Track) PublisherID ¶
func (t *Track) PublisherID() livekit.ParticipantID
func (*Track) SetMaxLayer ¶ added in v1.4.2
func (t *Track) SetMaxLayer(layer buffer.VideoLayer) bool
func (*Track) SetPriority ¶
func (*Track) SetStreamState ¶ added in v1.4.5
func (t *Track) SetStreamState(streamState StreamState) bool
func (*Track) WritePaddingRTP ¶
func (*Track) WriteProbePackets ¶ added in v1.8.1
type TrackSorter ¶
type TrackSorter []*Track
func (TrackSorter) Len ¶
func (t TrackSorter) Len() int
func (TrackSorter) Less ¶
func (t TrackSorter) Less(i, j int) bool
func (TrackSorter) Swap ¶
func (t TrackSorter) Swap(i, j int)