From 101e99f406b8139e126bcc8626278d30511327ee Mon Sep 17 00:00:00 2001 From: Lynnworld Date: Fri, 18 Oct 2024 17:24:24 +0800 Subject: [PATCH] Fix #492 SimulcastConsumer cannot switch layers if initial tsReferenceSpatialLayer disappears --- worker/src/RTC/SimulcastConsumer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/worker/src/RTC/SimulcastConsumer.cpp b/worker/src/RTC/SimulcastConsumer.cpp index fcd60c1c5f..5ace36df3d 100644 --- a/worker/src/RTC/SimulcastConsumer.cpp +++ b/worker/src/RTC/SimulcastConsumer.cpp @@ -1574,7 +1574,9 @@ namespace RTC MS_TRACE(); // If we don't have yet a RTP timestamp reference, set it now. - if (newTargetSpatialLayer != -1 && this->tsReferenceSpatialLayer == -1) + if ( + newTargetSpatialLayer != -1 && (this->tsReferenceSpatialLayer == -1 || + !GetProducerTsReferenceRtpStream()->GetSenderReportNtpMs())) { MS_DEBUG_TAG( simulcast, "using spatial layer %" PRIi16 " as RTP timestamp reference", newTargetSpatialLayer); @@ -1646,10 +1648,7 @@ namespace RTC return ( this->tsReferenceSpatialLayer == -1 || spatialLayer == this->tsReferenceSpatialLayer || - ( - GetProducerTsReferenceRtpStream()->GetSenderReportNtpMs() && - this->producerRtpStreams.at(spatialLayer)->GetSenderReportNtpMs() - ) + this->producerRtpStreams.at(spatialLayer)->GetSenderReportNtpMs() ); // clang-format on }