From 75c3df88e9351e2b0520c1356d00bff764816b14 Mon Sep 17 00:00:00 2001 From: satoren Date: Sat, 28 Jan 2023 10:36:05 +0900 Subject: [PATCH 1/3] Fix SimulcastConsumer fails to switch spatial layers (#990) In that case the consumer video was frozen. --- worker/src/RTC/SimulcastConsumer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/worker/src/RTC/SimulcastConsumer.cpp b/worker/src/RTC/SimulcastConsumer.cpp index 59b63ebcf9..d7d1fdfaa5 100644 --- a/worker/src/RTC/SimulcastConsumer.cpp +++ b/worker/src/RTC/SimulcastConsumer.cpp @@ -685,12 +685,13 @@ namespace RTC // Check whether this is the packet we are waiting for in order to update // the current spatial layer. - if (this->currentSpatialLayer != this->targetSpatialLayer && spatialLayer == this->targetSpatialLayer) + if ( + // clang-format off + this->currentSpatialLayer != this->targetSpatialLayer && + spatialLayer == this->targetSpatialLayer && + packet->IsKeyFrame()) + // clang-format on { - // Ignore if not a key frame. - if (!packet->IsKeyFrame()) - return; - shouldSwitchCurrentSpatialLayer = true; // Need to resync the stream. From 530e886036b6f852bb6c5878ece97906c89b51a9 Mon Sep 17 00:00:00 2001 From: satoren Date: Mon, 30 Jan 2023 12:12:09 +0900 Subject: [PATCH 2/3] fix lint error --- worker/src/RTC/SimulcastConsumer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/src/RTC/SimulcastConsumer.cpp b/worker/src/RTC/SimulcastConsumer.cpp index d7d1fdfaa5..dc3a621953 100644 --- a/worker/src/RTC/SimulcastConsumer.cpp +++ b/worker/src/RTC/SimulcastConsumer.cpp @@ -685,12 +685,12 @@ namespace RTC // Check whether this is the packet we are waiting for in order to update // the current spatial layer. + // clang-format off if ( - // clang-format off this->currentSpatialLayer != this->targetSpatialLayer && spatialLayer == this->targetSpatialLayer && packet->IsKeyFrame()) - // clang-format on + // clang-format on { shouldSwitchCurrentSpatialLayer = true; From a89308d302b24bc7a304ef67af49d42c9345e0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 30 Jan 2023 13:34:24 +0100 Subject: [PATCH 3/3] Update worker/src/RTC/SimulcastConsumer.cpp --- worker/src/RTC/SimulcastConsumer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/src/RTC/SimulcastConsumer.cpp b/worker/src/RTC/SimulcastConsumer.cpp index dc3a621953..05554ab335 100644 --- a/worker/src/RTC/SimulcastConsumer.cpp +++ b/worker/src/RTC/SimulcastConsumer.cpp @@ -689,7 +689,8 @@ namespace RTC if ( this->currentSpatialLayer != this->targetSpatialLayer && spatialLayer == this->targetSpatialLayer && - packet->IsKeyFrame()) + packet->IsKeyFrame() + ) // clang-format on { shouldSwitchCurrentSpatialLayer = true;