summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0064.patch
blob: 34ab2beb03d3e72d8ad015260bd3201ee023fa3b (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
172
173
174
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 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<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
@@ -237,6 +238,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
   }
   return true;
 }
+#endif
 
 // From RFC 5450: Transmission Time Offsets in RTP Streams.
 //
@@ -446,6 +448,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
@@ -484,6 +487,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 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<uint8_t> data,
                     rtc::ArrayView<const uint8_t> 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<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 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<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
     }
   }
 
-- 
2.34.1