Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: webrtc/ortc/ortcfactory.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: deps, again Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/ortc/ortcfactory.h ('k') | webrtc/ortc/ortcfactory_integrationtest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 namespace webrtc { 70 namespace webrtc {
71 71
72 // Note that this proxy class uses the network thread as the "worker" thread. 72 // Note that this proxy class uses the network thread as the "worker" thread.
73 BEGIN_OWNED_PROXY_MAP(OrtcFactory) 73 BEGIN_OWNED_PROXY_MAP(OrtcFactory)
74 PROXY_SIGNALING_THREAD_DESTRUCTOR() 74 PROXY_SIGNALING_THREAD_DESTRUCTOR()
75 PROXY_METHOD0(RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>, 75 PROXY_METHOD0(RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>,
76 CreateRtpTransportController) 76 CreateRtpTransportController)
77 PROXY_METHOD4(RTCErrorOr<std::unique_ptr<RtpTransportInterface>>, 77 PROXY_METHOD4(RTCErrorOr<std::unique_ptr<RtpTransportInterface>>,
78 CreateRtpTransport, 78 CreateRtpTransport,
79 const RtcpParameters&, 79 const RtpTransportParameters&,
80 PacketTransportInterface*, 80 PacketTransportInterface*,
81 PacketTransportInterface*, 81 PacketTransportInterface*,
82 RtpTransportControllerInterface*) 82 RtpTransportControllerInterface*)
83 83
84 PROXY_METHOD4(RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>, 84 PROXY_METHOD4(RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>,
85 CreateSrtpTransport, 85 CreateSrtpTransport,
86 const RtcpParameters&, 86 const RtpTransportParameters&,
87 PacketTransportInterface*, 87 PacketTransportInterface*,
88 PacketTransportInterface*, 88 PacketTransportInterface*,
89 RtpTransportControllerInterface*) 89 RtpTransportControllerInterface*)
90 90
91 PROXY_CONSTMETHOD1(RtpCapabilities, 91 PROXY_CONSTMETHOD1(RtpCapabilities,
92 GetRtpSenderCapabilities, 92 GetRtpSenderCapabilities,
93 cricket::MediaType) 93 cricket::MediaType)
94 PROXY_METHOD2(RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>>, 94 PROXY_METHOD2(RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>>,
95 CreateRtpSender, 95 CreateRtpSender,
96 rtc::scoped_refptr<MediaStreamTrackInterface>, 96 rtc::scoped_refptr<MediaStreamTrackInterface>,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> 219 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>
220 OrtcFactory::CreateRtpTransportController() { 220 OrtcFactory::CreateRtpTransportController() {
221 RTC_DCHECK_RUN_ON(signaling_thread_); 221 RTC_DCHECK_RUN_ON(signaling_thread_);
222 return RtpTransportControllerAdapter::CreateProxied( 222 return RtpTransportControllerAdapter::CreateProxied(
223 cricket::MediaConfig(), channel_manager_.get(), null_event_log_.get(), 223 cricket::MediaConfig(), channel_manager_.get(), null_event_log_.get(),
224 signaling_thread_, worker_thread_.get()); 224 signaling_thread_, worker_thread_.get());
225 } 225 }
226 226
227 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> 227 RTCErrorOr<std::unique_ptr<RtpTransportInterface>>
228 OrtcFactory::CreateRtpTransport( 228 OrtcFactory::CreateRtpTransport(
229 const RtcpParameters& rtcp_parameters, 229 const RtpTransportParameters& parameters,
230 PacketTransportInterface* rtp, 230 PacketTransportInterface* rtp,
231 PacketTransportInterface* rtcp, 231 PacketTransportInterface* rtcp,
232 RtpTransportControllerInterface* transport_controller) { 232 RtpTransportControllerInterface* transport_controller) {
233 RTC_DCHECK_RUN_ON(signaling_thread_); 233 RTC_DCHECK_RUN_ON(signaling_thread_);
234 RtcpParameters copied_parameters = rtcp_parameters; 234 RtpTransportParameters copied_parameters = parameters;
235 if (copied_parameters.cname.empty()) { 235 if (copied_parameters.rtcp.cname.empty()) {
236 copied_parameters.cname = default_cname_; 236 copied_parameters.rtcp.cname = default_cname_;
237 } 237 }
238 if (transport_controller) { 238 if (transport_controller) {
239 return transport_controller->GetInternal()->CreateProxiedRtpTransport( 239 return transport_controller->GetInternal()->CreateProxiedRtpTransport(
240 copied_parameters, rtp, rtcp); 240 copied_parameters, rtp, rtcp);
241 } else { 241 } else {
242 // If |transport_controller| is null, create one automatically, which the 242 // If |transport_controller| is null, create one automatically, which the
243 // returned RtpTransport will own. 243 // returned RtpTransport will own.
244 auto controller_result = CreateRtpTransportController(); 244 auto controller_result = CreateRtpTransportController();
245 if (!controller_result.ok()) { 245 if (!controller_result.ok()) {
246 return controller_result.MoveError(); 246 return controller_result.MoveError();
247 } 247 }
248 auto controller = controller_result.MoveValue(); 248 auto controller = controller_result.MoveValue();
249 auto transport_result = 249 auto transport_result =
250 controller->GetInternal()->CreateProxiedRtpTransport(copied_parameters, 250 controller->GetInternal()->CreateProxiedRtpTransport(copied_parameters,
251 rtp, rtcp); 251 rtp, rtcp);
252 // If RtpTransport was successfully created, transfer ownership of 252 // If RtpTransport was successfully created, transfer ownership of
253 // |rtp_transport_controller|. Otherwise it will go out of scope and be 253 // |rtp_transport_controller|. Otherwise it will go out of scope and be
254 // deleted automatically. 254 // deleted automatically.
255 if (transport_result.ok()) { 255 if (transport_result.ok()) {
256 transport_result.value() 256 transport_result.value()
257 ->GetInternal() 257 ->GetInternal()
258 ->TakeOwnershipOfRtpTransportController(std::move(controller)); 258 ->TakeOwnershipOfRtpTransportController(std::move(controller));
259 } 259 }
260 return transport_result; 260 return transport_result;
261 } 261 }
262 } 262 }
263 263
264 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> 264 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
265 OrtcFactory::CreateSrtpTransport( 265 OrtcFactory::CreateSrtpTransport(
266 const RtcpParameters& rtcp_parameters, 266 const RtpTransportParameters& parameters,
267 PacketTransportInterface* rtp, 267 PacketTransportInterface* rtp,
268 PacketTransportInterface* rtcp, 268 PacketTransportInterface* rtcp,
269 RtpTransportControllerInterface* transport_controller) { 269 RtpTransportControllerInterface* transport_controller) {
270 RTC_DCHECK_RUN_ON(signaling_thread_); 270 RTC_DCHECK_RUN_ON(signaling_thread_);
271 RtcpParameters copied_parameters = rtcp_parameters; 271 RtpTransportParameters copied_parameters = parameters;
272 if (copied_parameters.cname.empty()) { 272 if (copied_parameters.rtcp.cname.empty()) {
273 copied_parameters.cname = default_cname_; 273 copied_parameters.rtcp.cname = default_cname_;
274 } 274 }
275 if (transport_controller) { 275 if (transport_controller) {
276 return transport_controller->GetInternal()->CreateProxiedSrtpTransport( 276 return transport_controller->GetInternal()->CreateProxiedSrtpTransport(
277 copied_parameters, rtp, rtcp); 277 copied_parameters, rtp, rtcp);
278 } else { 278 } else {
279 // If |transport_controller| is null, create one automatically, which the 279 // If |transport_controller| is null, create one automatically, which the
280 // returned SrtpTransport will own. 280 // returned SrtpTransport will own.
281 auto controller_result = CreateRtpTransportController(); 281 auto controller_result = CreateRtpTransportController();
282 if (!controller_result.ok()) { 282 if (!controller_result.ok()) {
283 return controller_result.MoveError(); 283 return controller_result.MoveError();
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // 545 //
546 // Note that |adm_| may be null, in which case the platform-specific default 546 // Note that |adm_| may be null, in which case the platform-specific default
547 // AudioDeviceModule will be used. 547 // AudioDeviceModule will be used.
548 return std::unique_ptr<cricket::MediaEngineInterface>( 548 return std::unique_ptr<cricket::MediaEngineInterface>(
549 cricket::WebRtcMediaEngineFactory::Create( 549 cricket::WebRtcMediaEngineFactory::Create(
550 adm_, audio_encoder_factory_, audio_decoder_factory_, nullptr, 550 adm_, audio_encoder_factory_, audio_decoder_factory_, nullptr,
551 nullptr, nullptr, webrtc::AudioProcessing::Create())); 551 nullptr, nullptr, webrtc::AudioProcessing::Create()));
552 } 552 }
553 553
554 } // namespace webrtc 554 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/ortc/ortcfactory.h ('k') | webrtc/ortc/ortcfactory_integrationtest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698