From 92d47ec421dc4e4d7d5682413c9453831a448f9b Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Fri, 18 Feb 2022 16:26:27 +0530 Subject: [PATCH] Resync uses SSRC change. Reset to 0 when a resync is needed. (#446) --- pkg/sfu/forwarder.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index 1323010b5..a5c83c28c 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -516,7 +516,7 @@ func (f *Forwarder) Allocate(availableChannelCapacity int64, allowPause bool, br } f.targetLayers = f.lastAllocation.targetLayers if f.targetLayers == InvalidLayers { - f.currentLayers = InvalidLayers + f.resyncLocked() } return f.lastAllocation @@ -825,7 +825,7 @@ func (f *Forwarder) ProvisionalAllocateCommit() VideoAllocation { } f.targetLayers = f.lastAllocation.targetLayers if f.targetLayers == InvalidLayers { - f.currentLayers = InvalidLayers + f.resyncLocked() } return f.lastAllocation @@ -856,7 +856,7 @@ func (f *Forwarder) FinalizeAllocate(brs Bitrates) VideoAllocation { } f.targetLayers = f.lastAllocation.targetLayers if f.targetLayers == InvalidLayers { - f.currentLayers = InvalidLayers + f.resyncLocked() } } @@ -1125,7 +1125,7 @@ func (f *Forwarder) Pause(brs Bitrates) VideoAllocation { } f.targetLayers = f.lastAllocation.targetLayers if f.targetLayers == InvalidLayers { - f.currentLayers = InvalidLayers + f.resyncLocked() } return f.lastAllocation @@ -1135,6 +1135,10 @@ func (f *Forwarder) Resync() { f.lock.Lock() defer f.lock.Unlock() + f.resyncLocked() +} + +func (f *Forwarder) resyncLocked() { f.currentLayers = InvalidLayers f.lastSSRC = 0 }