mirror of
https://github.com/livekit/livekit.git
synced 2026-05-13 05:45:13 +00:00
Merge remote-tracking branch 'origin/master' into raja_fr
This commit is contained in:
+11
-10
@@ -152,16 +152,17 @@ type CongestionControlChannelObserverConfig struct {
|
||||
}
|
||||
|
||||
type CongestionControlConfig struct {
|
||||
Enabled bool `yaml:"enabled,omitempty"`
|
||||
AllowPause bool `yaml:"allow_pause,omitempty"`
|
||||
NackRatioAttenuator float64 `yaml:"nack_ratio_attenuator,omitempty"`
|
||||
ExpectedUsageThreshold float64 `yaml:"expected_usage_threshold,omitempty"`
|
||||
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
||||
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
||||
MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"`
|
||||
ProbeConfig CongestionControlProbeConfig `yaml:"probe_config,omitempty"`
|
||||
ChannelObserverProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_probe_config,omitempty"`
|
||||
ChannelObserverNonProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_non_probe_config,omitempty"`
|
||||
Enabled bool `yaml:"enabled,omitempty"`
|
||||
AllowPause bool `yaml:"allow_pause,omitempty"`
|
||||
NackRatioAttenuator float64 `yaml:"nack_ratio_attenuator,omitempty"`
|
||||
ExpectedUsageThreshold float64 `yaml:"expected_usage_threshold,omitempty"`
|
||||
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
||||
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
||||
MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"`
|
||||
ProbeConfig CongestionControlProbeConfig `yaml:"probe_config,omitempty"`
|
||||
ChannelObserverProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_probe_config,omitempty"`
|
||||
ChannelObserverNonProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_non_probe_config,omitempty"`
|
||||
DisableEstimationUnmanagedTracks bool `yaml:"disable_etimation_unmanaged_tracks,omitempty"`
|
||||
}
|
||||
|
||||
type AudioConfig struct {
|
||||
|
||||
+27
-3
@@ -181,6 +181,9 @@ type DownTrackStreamAllocatorListener interface {
|
||||
|
||||
// RTCP Receiver Report received
|
||||
OnRTCPReceiverReport(dt *DownTrack, rr rtcp.ReceptionReport)
|
||||
|
||||
// check if track should participate in BWE
|
||||
IsBWEEnabled(dt *DownTrack) bool
|
||||
}
|
||||
|
||||
type ReceiverReportListener func(dt *DownTrack, report *rtcp.ReceiverReport)
|
||||
@@ -444,8 +447,13 @@ func (d *DownTrack) SetStreamAllocatorListener(listener DownTrackStreamAllocator
|
||||
d.streamAllocatorListener = listener
|
||||
d.streamAllocatorLock.Unlock()
|
||||
|
||||
// kick of a gratuitous allocation
|
||||
if listener != nil {
|
||||
if !listener.IsBWEEnabled(d) {
|
||||
d.absSendTimeExtID = 0
|
||||
d.transportWideExtID = 0
|
||||
}
|
||||
|
||||
// kick of a gratuitous allocation
|
||||
listener.OnSubscriptionChanged(d)
|
||||
}
|
||||
}
|
||||
@@ -516,16 +524,32 @@ func (d *DownTrack) SubscriberID() livekit.ParticipantID { return d.params.SubID
|
||||
|
||||
// Sets RTP header extensions for this track
|
||||
func (d *DownTrack) SetRTPHeaderExtensions(rtpHeaderExtensions []webrtc.RTPHeaderExtensionParameter) {
|
||||
d.streamAllocatorLock.RLock()
|
||||
listener := d.streamAllocatorListener
|
||||
d.streamAllocatorLock.RUnlock()
|
||||
|
||||
isBWEEnabled := true
|
||||
if listener != nil {
|
||||
isBWEEnabled = listener.IsBWEEnabled(d)
|
||||
}
|
||||
for _, ext := range rtpHeaderExtensions {
|
||||
switch ext.URI {
|
||||
case sdp.ABSSendTimeURI:
|
||||
d.absSendTimeExtID = ext.ID
|
||||
if isBWEEnabled {
|
||||
d.absSendTimeExtID = ext.ID
|
||||
} else {
|
||||
d.absSendTimeExtID = 0
|
||||
}
|
||||
case dd.ExtensionURI:
|
||||
d.dependencyDescriptorExtID = ext.ID
|
||||
case rtpextension.PlayoutDelayURI:
|
||||
d.playoutDelayExtID = ext.ID
|
||||
case sdp.TransportCCURI:
|
||||
d.transportWideExtID = ext.ID
|
||||
if isBWEEnabled {
|
||||
d.transportWideExtID = ext.ID
|
||||
} else {
|
||||
d.transportWideExtID = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,6 +499,22 @@ func (s *StreamAllocator) OnActiveChanged(isActive bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// called to check if track should participate in BWE
|
||||
func (s *StreamAllocator) IsBWEEnabled(downTrack *sfu.DownTrack) bool {
|
||||
if !s.params.Config.DisableEstimationUnmanagedTracks {
|
||||
return true
|
||||
}
|
||||
|
||||
s.videoTracksMu.Lock()
|
||||
defer s.videoTracksMu.Unlock()
|
||||
|
||||
if track := s.videoTracks[livekit.TrackID(downTrack.ID())]; track != nil {
|
||||
return track.IsManaged()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *StreamAllocator) maybePostEventAllocateTrack(downTrack *sfu.DownTrack) {
|
||||
shouldPost := false
|
||||
s.videoTracksMu.Lock()
|
||||
@@ -1097,7 +1113,9 @@ func (s *StreamAllocator) allocateAllTracks() {
|
||||
updateStreamStateChange(track, allocation, update)
|
||||
|
||||
// STREAM-ALLOCATOR-TODO: optimistic allocation before bitrate is available will return 0. How to account for that?
|
||||
availableChannelCapacity -= allocation.BandwidthRequested
|
||||
if !s.params.Config.DisableEstimationUnmanagedTracks {
|
||||
availableChannelCapacity -= allocation.BandwidthRequested
|
||||
}
|
||||
}
|
||||
|
||||
if availableChannelCapacity < 0 {
|
||||
|
||||
Reference in New Issue
Block a user