From: Andreas Pehrson Date: Mon, 18 Jan 2021 11:07:00 +0100 Subject: Bug 1766646 - (fix-ae0d117d51) ifdef our Csrc impl vs upstream's impl, see Bug 1771332. --- modules/rtp_rtcp/source/rtp_header_extensions.cc | 4 ++++ modules/rtp_rtcp/source/rtp_header_extensions.h | 4 ++++ modules/rtp_rtcp/source/rtp_packet.cc | 4 ++++ modules/rtp_rtcp/source/rtp_sender.cc | 4 ++++ test/fuzzers/rtp_packet_fuzzer.cc | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc index a57d9e7f62..de29fd2075 100644 --- a/modules/rtp_rtcp/source/rtp_header_extensions.cc +++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc @@ -185,6 +185,7 @@ bool AudioLevel::Write(rtc::ArrayView data, return true; } +#if !defined(WEBRTC_MOZILLA_BUILD) // An RTP Header Extension for Mixer-to-Client Audio Level Indication // // https://tools.ietf.org/html/rfc6465 @@ -237,6 +238,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView data, } return true; } +#endif // From RFC 5450: Transmission Time Offsets in RTP Streams. // @@ -446,6 +448,7 @@ bool PlayoutDelayLimits::Write(rtc::ArrayView data, return true; } +#if defined(WEBRTC_MOZILLA_BUILD) // CSRCAudioLevel // Sample Audio Level Encoding Using the One-Byte Header Format // Note that the range of len is 1 to 15 which is encoded as 0 to 14 @@ -484,6 +487,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView data, // This extension if used must have at least one audio level return csrcAudioLevels.numAudioLevels; } +#endif // Video Content Type. // diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.h b/modules/rtp_rtcp/source/rtp_header_extensions.h index 89c73955a2..4b4984bf6d 100644 --- a/modules/rtp_rtcp/source/rtp_header_extensions.h +++ b/modules/rtp_rtcp/source/rtp_header_extensions.h @@ -88,6 +88,7 @@ class AudioLevel { uint8_t audio_level); }; +#if !defined(WEBRTC_MOZILLA_BUILD) class CsrcAudioLevel { public: static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel; @@ -102,6 +103,7 @@ class CsrcAudioLevel { static bool Write(rtc::ArrayView data, rtc::ArrayView csrc_audio_levels); }; +#endif class TransmissionOffset { public: @@ -292,6 +294,7 @@ class ColorSpaceExtension { static size_t WriteLuminance(uint8_t* data, float f, int denominator); }; +#if defined(WEBRTC_MOZILLA_BUILD) class CsrcAudioLevel { public: static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel; @@ -306,6 +309,7 @@ class CsrcAudioLevel { static size_t ValueSize(const CsrcAudioLevelList& csrcAudioLevels); static bool Write(rtc::ArrayView data, const CsrcAudioLevelList& csrcAudioLevels); }; +#endif // Base extension class for RTP header extensions which are strings. // Subclasses must defined kId and kUri static constexpr members. diff --git a/modules/rtp_rtcp/source/rtp_packet.cc b/modules/rtp_rtcp/source/rtp_packet.cc index 9495841984..fd2f5c5ae8 100644 --- a/modules/rtp_rtcp/source/rtp_packet.cc +++ b/modules/rtp_rtcp/source/rtp_packet.cc @@ -187,7 +187,9 @@ void RtpPacket::ZeroMutableExtensions() { break; } case RTPExtensionType::kRtpExtensionAudioLevel: +#if !defined(WEBRTC_MOZILLA_BUILD) case RTPExtensionType::kRtpExtensionCsrcAudioLevel: +#endif case RTPExtensionType::kRtpExtensionAbsoluteCaptureTime: case RTPExtensionType::kRtpExtensionColorSpace: case RTPExtensionType::kRtpExtensionGenericFrameDescriptor: @@ -205,10 +207,12 @@ void RtpPacket::ZeroMutableExtensions() { // Non-mutable extension. Don't change it. break; } +#if defined(WEBRTC_MOZILLA_BUILD) case RTPExtensionType::kRtpExtensionCsrcAudioLevel: { // TODO: This is a Mozilla addition, we need to add a handler for this. RTC_CHECK(false); } +#endif } } } diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc index 0ed7243d0a..336a117f4e 100644 --- a/modules/rtp_rtcp/source/rtp_sender.cc +++ b/modules/rtp_rtcp/source/rtp_sender.cc @@ -108,7 +108,9 @@ bool IsNonVolatile(RTPExtensionType type) { switch (type) { case kRtpExtensionTransmissionTimeOffset: case kRtpExtensionAudioLevel: +#if !defined(WEBRTC_MOZILLA_BUILD) case kRtpExtensionCsrcAudioLevel: +#endif case kRtpExtensionAbsoluteSendTime: case kRtpExtensionTransportSequenceNumber: case kRtpExtensionTransportSequenceNumber02: @@ -132,10 +134,12 @@ bool IsNonVolatile(RTPExtensionType type) { case kRtpExtensionNumberOfExtensions: RTC_DCHECK_NOTREACHED(); return false; +#if defined(WEBRTC_MOZILLA_BUILD) case kRtpExtensionCsrcAudioLevel: // TODO: Mozilla implement for CsrcAudioLevel RTC_CHECK(false); return false; +#endif } RTC_CHECK_NOTREACHED(); } diff --git a/test/fuzzers/rtp_packet_fuzzer.cc b/test/fuzzers/rtp_packet_fuzzer.cc index 0e10a8fa3a..5d117529bb 100644 --- a/test/fuzzers/rtp_packet_fuzzer.cc +++ b/test/fuzzers/rtp_packet_fuzzer.cc @@ -77,11 +77,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) { uint8_t audio_level; packet.GetExtension(&voice_activity, &audio_level); break; +#if !defined(WEBRTC_MOZILLA_BUILD) case kRtpExtensionCsrcAudioLevel: { std::vector audio_levels; packet.GetExtension(&audio_levels); break; } +#endif case kRtpExtensionAbsoluteSendTime: uint32_t sendtime; packet.GetExtension(&sendtime); @@ -164,11 +166,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) { // This extension requires state to read and so complicated that // deserves own fuzzer. break; +#if defined(WEBRTC_MOZILLA_BUILD) case kRtpExtensionCsrcAudioLevel: { CsrcAudioLevelList levels; packet.GetExtension(&levels); break; } +#endif } } -- 2.34.1