summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0058.patch
blob: 00b30f90f9fae41d3f94a8b0f382d6cf68016c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From: Andreas Pehrson <apehrson@mozilla.com>
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 b86a7d775c..ea41226abf 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.cc
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc
@@ -181,6 +181,7 @@ bool AudioLevel::Write(rtc::ArrayView<uint8_t> 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
@@ -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 fff7db0294..09bd9912e1 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.h
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.h
@@ -94,6 +94,7 @@ class AudioLevel {
                     uint8_t audio_level);
 };
 
+#if !defined(WEBRTC_MOZILLA_BUILD)
 class CsrcAudioLevel {
  public:
   static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -108,6 +109,7 @@ class CsrcAudioLevel {
   static bool Write(rtc::ArrayView<uint8_t> data,
                     rtc::ArrayView<const uint8_t> csrc_audio_levels);
 };
+#endif
 
 class TransmissionOffset {
  public:
@@ -298,6 +300,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;
@@ -312,6 +315,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 b152cdbd9e..7181b303e1 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 f4ba024444..4972aa0802 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -104,7 +104,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:
@@ -128,10 +130,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<AudioLevel>(&voice_activity, &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);
@@ -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<CsrcAudioLevel>(&levels);
         break;
       }
+#endif
     }
   }