| OLD | NEW |
| 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 Loading... |
| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 OrtcFactory::~OrtcFactory() { | 212 OrtcFactory::~OrtcFactory() { |
| 213 RTC_DCHECK_RUN_ON(signaling_thread_); | 213 RTC_DCHECK_RUN_ON(signaling_thread_); |
| 214 if (wraps_signaling_thread_) { | 214 if (wraps_signaling_thread_) { |
| 215 rtc::ThreadManager::Instance()->UnwrapCurrentThread(); | 215 rtc::ThreadManager::Instance()->UnwrapCurrentThread(); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> | 219 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> |
| 220 OrtcFactory::CreateRtpTransportController() { | 220 OrtcFactory::CreateRtpTransportController() { |
| 221 return CreateRtpTransportController(RtpTransportParameters()); |
| 222 } |
| 223 |
| 224 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> |
| 225 OrtcFactory::CreateRtpTransportController( |
| 226 const RtpTransportParameters& parameters) { |
| 221 RTC_DCHECK_RUN_ON(signaling_thread_); | 227 RTC_DCHECK_RUN_ON(signaling_thread_); |
| 222 return RtpTransportControllerAdapter::CreateProxied( | 228 return RtpTransportControllerAdapter::CreateProxied( |
| 223 cricket::MediaConfig(), channel_manager_.get(), null_event_log_.get(), | 229 cricket::MediaConfig(), parameters, channel_manager_.get(), |
| 224 signaling_thread_, worker_thread_.get()); | 230 null_event_log_.get(), signaling_thread_, worker_thread_.get()); |
| 225 } | 231 } |
| 226 | 232 |
| 227 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> | 233 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> |
| 228 OrtcFactory::CreateRtpTransport( | 234 OrtcFactory::CreateRtpTransport( |
| 229 const RtcpParameters& rtcp_parameters, | 235 const RtpTransportParameters& parameters, |
| 230 PacketTransportInterface* rtp, | 236 PacketTransportInterface* rtp, |
| 231 PacketTransportInterface* rtcp, | 237 PacketTransportInterface* rtcp, |
| 232 RtpTransportControllerInterface* transport_controller) { | 238 RtpTransportControllerInterface* transport_controller) { |
| 233 RTC_DCHECK_RUN_ON(signaling_thread_); | 239 RTC_DCHECK_RUN_ON(signaling_thread_); |
| 234 RtcpParameters copied_parameters = rtcp_parameters; | 240 RtpTransportParameters copied_parameters = parameters; |
| 235 if (copied_parameters.cname.empty()) { | 241 if (copied_parameters.rtcp.cname.empty()) { |
| 236 copied_parameters.cname = default_cname_; | 242 copied_parameters.rtcp.cname = default_cname_; |
| 237 } | 243 } |
| 238 if (transport_controller) { | 244 if (transport_controller) { |
| 239 return transport_controller->GetInternal()->CreateProxiedRtpTransport( | 245 return transport_controller->GetInternal()->CreateProxiedRtpTransport( |
| 240 copied_parameters, rtp, rtcp); | 246 copied_parameters, rtp, rtcp); |
| 241 } else { | 247 } else { |
| 242 // If |transport_controller| is null, create one automatically, which the | 248 // If |transport_controller| is null, create one automatically, which the |
| 243 // returned RtpTransport will own. | 249 // returned RtpTransport will own. |
| 244 auto controller_result = CreateRtpTransportController(); | 250 auto controller_result = CreateRtpTransportController(); |
| 245 if (!controller_result.ok()) { | 251 if (!controller_result.ok()) { |
| 246 return controller_result.MoveError(); | 252 return controller_result.MoveError(); |
| 247 } | 253 } |
| 248 auto controller = controller_result.MoveValue(); | 254 auto controller = controller_result.MoveValue(); |
| 249 auto transport_result = | 255 auto transport_result = |
| 250 controller->GetInternal()->CreateProxiedRtpTransport(copied_parameters, | 256 controller->GetInternal()->CreateProxiedRtpTransport(copied_parameters, |
| 251 rtp, rtcp); | 257 rtp, rtcp); |
| 252 // If RtpTransport was successfully created, transfer ownership of | 258 // If RtpTransport was successfully created, transfer ownership of |
| 253 // |rtp_transport_controller|. Otherwise it will go out of scope and be | 259 // |rtp_transport_controller|. Otherwise it will go out of scope and be |
| 254 // deleted automatically. | 260 // deleted automatically. |
| 255 if (transport_result.ok()) { | 261 if (transport_result.ok()) { |
| 256 transport_result.value() | 262 transport_result.value() |
| 257 ->GetInternal() | 263 ->GetInternal() |
| 258 ->TakeOwnershipOfRtpTransportController(std::move(controller)); | 264 ->TakeOwnershipOfRtpTransportController(std::move(controller)); |
| 259 } | 265 } |
| 260 return transport_result; | 266 return transport_result; |
| 261 } | 267 } |
| 262 } | 268 } |
| 263 | 269 |
| 264 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> | 270 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> |
| 265 OrtcFactory::CreateSrtpTransport( | 271 OrtcFactory::CreateSrtpTransport( |
| 266 const RtcpParameters& rtcp_parameters, | 272 const RtpTransportParameters& parameters, |
| 267 PacketTransportInterface* rtp, | 273 PacketTransportInterface* rtp, |
| 268 PacketTransportInterface* rtcp, | 274 PacketTransportInterface* rtcp, |
| 269 RtpTransportControllerInterface* transport_controller) { | 275 RtpTransportControllerInterface* transport_controller) { |
| 270 RTC_DCHECK_RUN_ON(signaling_thread_); | 276 RTC_DCHECK_RUN_ON(signaling_thread_); |
| 271 RtcpParameters copied_parameters = rtcp_parameters; | 277 RtpTransportParameters copied_parameters = parameters; |
| 272 if (copied_parameters.cname.empty()) { | 278 if (copied_parameters.rtcp.cname.empty()) { |
| 273 copied_parameters.cname = default_cname_; | 279 copied_parameters.rtcp.cname = default_cname_; |
| 274 } | 280 } |
| 275 if (transport_controller) { | 281 if (transport_controller) { |
| 276 return transport_controller->GetInternal()->CreateProxiedSrtpTransport( | 282 return transport_controller->GetInternal()->CreateProxiedSrtpTransport( |
| 277 copied_parameters, rtp, rtcp); | 283 copied_parameters, rtp, rtcp); |
| 278 } else { | 284 } else { |
| 279 // If |transport_controller| is null, create one automatically, which the | 285 // If |transport_controller| is null, create one automatically, which the |
| 280 // returned SrtpTransport will own. | 286 // returned SrtpTransport will own. |
| 281 auto controller_result = CreateRtpTransportController(); | 287 auto controller_result = CreateRtpTransportController(); |
| 282 if (!controller_result.ok()) { | 288 if (!controller_result.ok()) { |
| 283 return controller_result.MoveError(); | 289 return controller_result.MoveError(); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // | 550 // |
| 545 // Note that |adm_| may be null, in which case the platform-specific default | 551 // Note that |adm_| may be null, in which case the platform-specific default |
| 546 // AudioDeviceModule will be used. | 552 // AudioDeviceModule will be used. |
| 547 return std::unique_ptr<cricket::MediaEngineInterface>( | 553 return std::unique_ptr<cricket::MediaEngineInterface>( |
| 548 cricket::WebRtcMediaEngineFactory::Create( | 554 cricket::WebRtcMediaEngineFactory::Create( |
| 549 adm_, audio_encoder_factory_, audio_decoder_factory_, nullptr, | 555 adm_, audio_encoder_factory_, audio_decoder_factory_, nullptr, |
| 550 nullptr, nullptr, webrtc::AudioProcessing::Create())); | 556 nullptr, nullptr, webrtc::AudioProcessing::Create())); |
| 551 } | 557 } |
| 552 | 558 |
| 553 } // namespace webrtc | 559 } // namespace webrtc |
| OLD | NEW |