Reset DD tracker layers when muted. (#2920)

* Reset DD tracker layers when muted.

@cnderrauber, I think this is okay to do, but please let me know if
there are gotchas in there.

* copy

* more compact form
This commit is contained in:
Raja Subramanian
2024-08-10 15:42:14 +05:30
committed by GitHub
parent 64057c3e4d
commit d0ac19779e
2 changed files with 15 additions and 3 deletions
+1 -3
View File
@@ -545,9 +545,7 @@ func (s *StreamAllocator) maybePostEventAllocateTrack(downTrack *sfu.DownTrack)
shouldPost := false shouldPost := false
s.videoTracksMu.Lock() s.videoTracksMu.Lock()
if track := s.videoTracks[livekit.TrackID(downTrack.ID())]; track != nil { if track := s.videoTracks[livekit.TrackID(downTrack.ID())]; track != nil {
if track.SetDirty(true) { shouldPost = track.SetDirty(true)
shouldPost = true
}
} }
s.videoTracksMu.Unlock() s.videoTracksMu.Unlock()
+14
View File
@@ -117,6 +117,9 @@ func (s *StreamTrackerDependencyDescriptor) resetLocked() {
s.bitrate[i][j] = 0 s.bitrate[i][j] = 0
} }
} }
s.maxSpatialLayer = buffer.InvalidLayerSpatial
s.maxTemporalLayer = buffer.InvalidLayerTemporal
} }
func (s *StreamTrackerDependencyDescriptor) SetPaused(paused bool) { func (s *StreamTrackerDependencyDescriptor) SetPaused(paused bool) {
@@ -126,8 +129,14 @@ func (s *StreamTrackerDependencyDescriptor) SetPaused(paused bool) {
return return
} }
s.paused = paused s.paused = paused
var notifyFns []func(status StreamStatus)
var notifyStatus StreamStatus
if !paused { if !paused {
s.resetLocked() s.resetLocked()
notifyStatus = StreamStatusStopped
notifyFns = append(notifyFns, s.onStatusChanged[:]...)
} else { } else {
s.lastBitrateReport = time.Now() s.lastBitrateReport = time.Now()
go s.worker(s.generation.Inc()) go s.worker(s.generation.Inc())
@@ -135,6 +144,11 @@ func (s *StreamTrackerDependencyDescriptor) SetPaused(paused bool) {
} }
s.lock.Unlock() s.lock.Unlock()
for _, fn := range notifyFns {
if fn != nil {
fn(notifyStatus)
}
}
} }
func (s *StreamTrackerDependencyDescriptor) Observe(temporalLayer int32, pktSize int, payloadSize int, hasMarker bool, ts uint32, ddVal *buffer.ExtDependencyDescriptor) { func (s *StreamTrackerDependencyDescriptor) Observe(temporalLayer int32, pktSize int, payloadSize int, hasMarker bool, ts uint32, ddVal *buffer.ExtDependencyDescriptor) {