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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
From: Byron Campen <docfaraday@gmail.com>
Date: Fri, 31 Mar 2023 16:21:00 -0500
Subject: Bug 1822194 - (fix-acabb3641b) Break the new SetParametersCallback
stuff into stand-alone files.
acabb3641b from upstream added a callback mechanism to allow failures to be
propagated back to RTCRtpSender.setParameters. Unfortunately, this callback
mechanism was (needlessly) tightly coupled to libwebrtc's implementation of
RTCRtpSender, and also their media channel code. This introduced a lot of
unnecessary dependencies throughout libwebrtc, that spilled into our code as
well.
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/59232687efa00e5f7b7bd3d6befca129149e2bf5
---
api/BUILD.gn | 14 +++++++++++-
api/rtp_sender_interface.h | 4 ++--
api/rtp_sender_setparameters_callback.cc | 27 +++++++++++++++++++++++
api/rtp_sender_setparameters_callback.h | 28 ++++++++++++++++++++++++
call/BUILD.gn | 4 ++--
call/audio_send_stream.h | 2 +-
call/video_send_stream.h | 2 +-
media/BUILD.gn | 2 +-
media/base/media_channel.h | 4 ----
media/base/media_channel_impl.cc | 13 -----------
video/BUILD.gn | 4 ++--
11 files changed, 77 insertions(+), 27 deletions(-)
create mode 100644 api/rtp_sender_setparameters_callback.cc
create mode 100644 api/rtp_sender_setparameters_callback.h
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 3f313e2743..56afc5efce 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -214,8 +214,8 @@ rtc_library("rtp_sender_interface") {
":dtmf_sender_interface",
":frame_transformer_interface",
":media_stream_interface",
- ":rtc_error",
":rtp_parameters",
+ ":rtp_sender_setparameters_callback",
":scoped_refptr",
"../rtc_base:checks",
"../rtc_base:refcount",
@@ -223,6 +223,18 @@ rtc_library("rtp_sender_interface") {
"crypto:frame_encryptor_interface",
"video_codecs:video_codecs_api",
]
+}
+
+rtc_library("rtp_sender_setparameters_callback") {
+ visibility = [ "*" ]
+
+ sources = [
+ "rtp_sender_setparameters_callback.cc",
+ "rtp_sender_setparameters_callback.h",
+ ]
+ deps = [
+ ":rtc_error",
+ ]
absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
diff --git a/api/rtp_sender_interface.h b/api/rtp_sender_interface.h
index 2786a2ac19..98ee91b1cc 100644
--- a/api/rtp_sender_interface.h
+++ b/api/rtp_sender_interface.h
@@ -32,9 +32,9 @@
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
-namespace webrtc {
+#include "api/rtp_sender_setparameters_callback.h"
-using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+namespace webrtc {
class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface {
public:
diff --git a/api/rtp_sender_setparameters_callback.cc b/api/rtp_sender_setparameters_callback.cc
new file mode 100644
index 0000000000..99728ef95e
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#include "api/rtp_sender_setparameters_callback.h"
+
+namespace webrtc {
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error) {
+ if (callback) {
+ std::move(callback)(error);
+ callback = nullptr;
+ }
+ return error;
+}
+
+} // namespace webrtc
diff --git a/api/rtp_sender_setparameters_callback.h b/api/rtp_sender_setparameters_callback.h
new file mode 100644
index 0000000000..45194f5ace
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#ifndef API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+#define API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+
+#include "api/rtc_error.h"
+#include "absl/functional/any_invocable.h"
+
+namespace webrtc {
+
+using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error);
+} // namespace webrtc
+
+#endif // API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
diff --git a/call/BUILD.gn b/call/BUILD.gn
index fb23b7ef39..2bc7aaec92 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -52,7 +52,7 @@ rtc_library("call_interfaces") {
"../api:rtc_error",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
@@ -389,7 +389,7 @@ rtc_library("video_stream_api") {
"../api:frame_transformer_interface",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index bafa22d312..187ec65ed8 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -25,7 +25,7 @@
#include "api/crypto/frame_encryptor_interface.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "call/audio_sender.h"
#include "call/rtp_config.h"
diff --git a/call/video_send_stream.h b/call/video_send_stream.h
index 431c267e1e..de18fc7b92 100644
--- a/call/video_send_stream.h
+++ b/call/video_send_stream.h
@@ -23,7 +23,7 @@
#include "api/crypto/crypto_options.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "api/video/video_content_type.h"
#include "api/video/video_frame.h"
diff --git a/media/BUILD.gn b/media/BUILD.gn
index daca67e033..80662563b0 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -64,7 +64,7 @@ rtc_library("rtc_media_base") {
"../api:media_stream_interface",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:sequence_checker",
"../api:transport_api",
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 43e09290bd..138d28ae4c 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -64,10 +64,6 @@ class Timing;
namespace webrtc {
class VideoFrame;
-
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error);
-
} // namespace webrtc
namespace cricket {
diff --git a/media/base/media_channel_impl.cc b/media/base/media_channel_impl.cc
index a72b97413d..0e72f47d6d 100644
--- a/media/base/media_channel_impl.cc
+++ b/media/base/media_channel_impl.cc
@@ -31,19 +31,6 @@
#include "modules/rtp_rtcp/include/report_block_data.h"
#include "rtc_base/checks.h"
-namespace webrtc {
-
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error) {
- if (callback) {
- std::move(callback)(error);
- callback = nullptr;
- }
- return error;
-}
-
-} // namespace webrtc
-
namespace cricket {
using webrtc::FrameDecryptorInterface;
using webrtc::FrameEncryptorInterface;
diff --git a/video/BUILD.gn b/video/BUILD.gn
index e21e1c7ea8..2c0a411e35 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -17,7 +17,7 @@ rtc_library("video_stream_encoder_interface") {
"../api:fec_controller_api",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api/adaptation:resource_adaptation_api",
"../api/units:data_rate",
@@ -410,7 +410,7 @@ rtc_library("video_stream_encoder_impl") {
":video_stream_encoder_interface",
"../api:field_trials_view",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:sequence_checker",
"../api/adaptation:resource_adaptation_api",
"../api/task_queue:pending_task_safety_flag",
--
2.34.1
|