From 75c3df88e9351e2b0520c1356d00bff764816b14 Mon Sep 17 00:00:00 2001 From: satoren Date: Sat, 28 Jan 2023 10:36:05 +0900 Subject: [PATCH] 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.