Log only on change and also don't log layer for audio (#934)

This commit is contained in:
Raja Subramanian
2022-08-20 10:04:21 +05:30
committed by GitHub
parent fae3857800
commit 26ba69c506
2 changed files with 6 additions and 6 deletions
-2
View File
@@ -610,7 +610,6 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int) int {
// Mute enables or disables media forwarding // Mute enables or disables media forwarding
func (d *DownTrack) Mute(muted bool) { func (d *DownTrack) Mute(muted bool) {
d.logger.Infow("setting mute", "muted", muted)
changed, maxLayers := d.forwarder.Mute(muted) changed, maxLayers := d.forwarder.Mute(muted)
if !changed { if !changed {
return return
@@ -708,7 +707,6 @@ func (d *DownTrack) CloseWithFlush(flush bool) {
} }
func (d *DownTrack) SetMaxSpatialLayer(spatialLayer int32) { func (d *DownTrack) SetMaxSpatialLayer(spatialLayer int32) {
d.logger.Infow("setting max spatial layer", "layer", spatialLayer)
changed, maxLayers, currentLayers := d.forwarder.SetMaxSpatialLayer(spatialLayer) changed, maxLayers, currentLayers := d.forwarder.SetMaxSpatialLayer(spatialLayer)
if !changed { if !changed {
return return
+6 -4
View File
@@ -273,18 +273,19 @@ func (f *Forwarder) SeedState(state ForwarderState) {
f.started = true f.started = true
} }
func (f *Forwarder) Mute(val bool) (bool, VideoLayers) { func (f *Forwarder) Mute(muted bool) (bool, VideoLayers) {
f.lock.Lock() f.lock.Lock()
defer f.lock.Unlock() defer f.lock.Unlock()
if f.muted == val { if f.muted == muted {
return false, f.maxLayers return false, f.maxLayers
} }
f.muted = val f.logger.Infow("setting mute", "muted", muted)
f.muted = muted
// resync when muted so that sequence numbers do not jump on unmute // resync when muted so that sequence numbers do not jump on unmute
if val { if muted {
f.resyncLocked() f.resyncLocked()
} }
@@ -306,6 +307,7 @@ func (f *Forwarder) SetMaxSpatialLayer(spatialLayer int32) (bool, VideoLayers, V
return false, f.maxLayers, f.currentLayers return false, f.maxLayers, f.currentLayers
} }
f.logger.Infow("setting max spatial layer", "layer", spatialLayer)
f.maxLayers.Spatial = spatialLayer f.maxLayers.Spatial = spatialLayer
return true, f.maxLayers, f.currentLayers return true, f.maxLayers, f.currentLayers