Source code
Revision control
Copy as Markdown
Other Tools
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:07:00 +0100
---
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 bb035729f8..53211fa2b4 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.cc
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc
@@ -181,6 +181,7 @@ bool AudioLevelExtension::Write(rtc::ArrayView<uint8_t> data,
return true;
}
+#if !defined(WEBRTC_MOZILLA_BUILD)
// An RTP Header Extension for Mixer-to-Client Audio Level Indication
//
@@ -230,6 +231,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
}
return true;
}
+#endif
// From RFC 5450: Transmission Time Offsets in RTP Streams.
//
@@ -423,6 +425,7 @@ bool PlayoutDelayLimits::Write(rtc::ArrayView<uint8_t> 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
@@ -461,6 +464,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> 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 ed816caa10..2ad2d18036 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.h
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.h
@@ -104,6 +104,7 @@ class AudioLevelExtension {
static bool Write(rtc::ArrayView<uint8_t> data, const AudioLevel& extension);
};
+#if !defined(WEBRTC_MOZILLA_BUILD)
class CsrcAudioLevel {
public:
static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -118,6 +119,7 @@ class CsrcAudioLevel {
static bool Write(rtc::ArrayView<uint8_t> data,
rtc::ArrayView<const uint8_t> csrc_audio_levels);
};
+#endif
class TransmissionOffset {
public:
@@ -308,6 +310,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;
@@ -322,6 +325,7 @@ class CsrcAudioLevel {
static size_t ValueSize(const CsrcAudioLevelList& csrcAudioLevels);
static bool Write(rtc::ArrayView<uint8_t> 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 3192c27a49..306c17e2c2 100644
--- a/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/modules/rtp_rtcp/source/rtp_packet.cc
@@ -193,7 +193,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::kRtpExtensionCorruptionDetection:
@@ -212,10 +214,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 258bfa1885..5b1c588197 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -115,7 +115,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:
@@ -140,10 +142,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 6a7b233e29..705ceee309 100644
--- a/test/fuzzers/rtp_packet_fuzzer.cc
+++ b/test/fuzzers/rtp_packet_fuzzer.cc
@@ -79,11 +79,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
packet.GetExtension<AudioLevelExtension>(&audio_level);
break;
}
+#if !defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
std::vector<uint8_t> audio_levels;
packet.GetExtension<CsrcAudioLevel>(&audio_levels);
break;
}
+#endif
case kRtpExtensionAbsoluteSendTime:
uint32_t sendtime;
packet.GetExtension<AbsoluteSendTime>(&sendtime);
@@ -170,11 +172,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
CorruptionDetectionMessage message;
packet.GetExtension<CorruptionDetectionExtension>(&message);
break;
+#if defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
CsrcAudioLevelList levels;
packet.GetExtension<CsrcAudioLevel>(&levels);
break;
}
+#endif
}
}