From cff3ed61d4318e9a21fbbe0eaa01844e5cc8e0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Negro=20Mart=C3=ADn?= Date: Mon, 24 Jun 2024 15:37:01 +0200 Subject: [PATCH] Address PR comments --- worker/include/RTC/RtpPacket.hpp | 2 ++ worker/src/RTC/Consumer.cpp | 10 +++++----- worker/src/RTC/Producer.cpp | 4 ++-- .../RtpDictionaries/RtpHeaderExtensionUri.cpp | 20 +++++++++---------- worker/src/RTC/RtpPacket.cpp | 1 + 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/worker/include/RTC/RtpPacket.hpp b/worker/include/RTC/RtpPacket.hpp index 6e4049cf39..e737b5b868 100644 --- a/worker/include/RTC/RtpPacket.hpp +++ b/worker/include/RTC/RtpPacket.hpp @@ -498,10 +498,12 @@ namespace RTC { uint8_t extenLen; uint8_t* extenValue = GetExtension(this->playoutDelayExtensionId, extenLen); + if (extenLen != 3) { return false; } + uint32_t v = Utils::Byte::Get3Bytes(extenValue, 0); minDelay = v >> 12u; maxDelay = v & 0xFFFu; diff --git a/worker/src/RTC/Consumer.cpp b/worker/src/RTC/Consumer.cpp index c7e7dcf914..832b083e3c 100644 --- a/worker/src/RTC/Consumer.cpp +++ b/worker/src/RTC/Consumer.cpp @@ -85,6 +85,11 @@ namespace RTC this->rtpHeaderExtensionIds.videoOrientation = exten.id; } + if (this->rtpHeaderExtensionIds.playoutDelay == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::PLAYOUT_DELAY) + { + this->rtpHeaderExtensionIds.playoutDelay = exten.id; + } + if (this->rtpHeaderExtensionIds.absSendTime == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::ABS_SEND_TIME) { this->rtpHeaderExtensionIds.absSendTime = exten.id; @@ -95,11 +100,6 @@ namespace RTC this->rtpHeaderExtensionIds.transportWideCc01 = exten.id; } - if (this->rtpHeaderExtensionIds.playoutDelay == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::PLAYOUT_DELAY) - { - this->rtpHeaderExtensionIds.playoutDelay = exten.id; - } - if (this->rtpHeaderExtensionIds.mid == 0u && exten.type == RTC::RtpHeaderExtensionUri::Type::MID) { this->rtpHeaderExtensionIds.mid = exten.id; diff --git a/worker/src/RTC/Producer.cpp b/worker/src/RTC/Producer.cpp index 7e89d902bd..e7f93b2792 100644 --- a/worker/src/RTC/Producer.cpp +++ b/worker/src/RTC/Producer.cpp @@ -1403,8 +1403,6 @@ namespace RTC packet->SetMidExtensionId(static_cast(RTC::RtpHeaderExtensionUri::Type::MID)); packet->SetAbsSendTimeExtensionId( static_cast(RTC::RtpHeaderExtensionUri::Type::ABS_SEND_TIME)); - packet->SetPlayoutDelayExtensionId( - static_cast(RTC::RtpHeaderExtensionUri::Type::PLAYOUT_DELAY)); packet->SetTransportWideCc01ExtensionId( static_cast(RTC::RtpHeaderExtensionUri::Type::TRANSPORT_WIDE_CC_01)); // NOTE: Remove this once framemarking draft becomes RFC. @@ -1416,6 +1414,8 @@ namespace RTC static_cast(RTC::RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL)); packet->SetVideoOrientationExtensionId( static_cast(RTC::RtpHeaderExtensionUri::Type::VIDEO_ORIENTATION)); + packet->SetPlayoutDelayExtensionId( + static_cast(RTC::RtpHeaderExtensionUri::Type::PLAYOUT_DELAY)); } return true; diff --git a/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp b/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp index ce8616e8dc..f451e7c7ba 100644 --- a/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp +++ b/worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp @@ -48,6 +48,11 @@ namespace RTC return RtpHeaderExtensionUri::Type::VIDEO_ORIENTATION; } + case FBS::RtpParameters::RtpHeaderExtensionUri::PlayoutDelay: + { + return RtpHeaderExtensionUri::Type::PLAYOUT_DELAY; + } + case FBS::RtpParameters::RtpHeaderExtensionUri::TimeOffset: { return RtpHeaderExtensionUri::Type::TOFFSET; @@ -67,11 +72,6 @@ namespace RTC { return RtpHeaderExtensionUri::Type::ABS_CAPTURE_TIME; } - - case FBS::RtpParameters::RtpHeaderExtensionUri::PlayoutDelay: - { - return RtpHeaderExtensionUri::Type::PLAYOUT_DELAY; - } } } @@ -125,6 +125,11 @@ namespace RTC return FBS::RtpParameters::RtpHeaderExtensionUri::VideoOrientation; } + case RtpHeaderExtensionUri::Type::PLAYOUT_DELAY: + { + return FBS::RtpParameters::RtpHeaderExtensionUri::PlayoutDelay; + } + case RtpHeaderExtensionUri::Type::TOFFSET: { return FBS::RtpParameters::RtpHeaderExtensionUri::TimeOffset; @@ -134,11 +139,6 @@ namespace RTC { return FBS::RtpParameters::RtpHeaderExtensionUri::AbsCaptureTime; } - - case RtpHeaderExtensionUri::Type::PLAYOUT_DELAY: - { - return FBS::RtpParameters::RtpHeaderExtensionUri::PlayoutDelay; - } } } diff --git a/worker/src/RTC/RtpPacket.cpp b/worker/src/RTC/RtpPacket.cpp index 3b047f659e..0196234f89 100644 --- a/worker/src/RTC/RtpPacket.cpp +++ b/worker/src/RTC/RtpPacket.cpp @@ -304,6 +304,7 @@ namespace RTC { uint16_t minDelay; uint16_t maxDelay; + if (ReadPlayoutDelay(minDelay, maxDelay)) { MS_DUMP(