Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 webrtc::MediaControllerInterface* media_controller, | 230 webrtc::MediaControllerInterface* media_controller, |
| 231 TransportController* transport_controller, | 231 TransportController* transport_controller, |
| 232 const std::string& content_name, | 232 const std::string& content_name, |
| 233 const std::string* bundle_transport_name, | 233 const std::string* bundle_transport_name, |
| 234 bool rtcp, | 234 bool rtcp, |
| 235 bool srtp_required, | 235 bool srtp_required, |
| 236 const AudioOptions& options) { | 236 const AudioOptions& options) { |
| 237 ASSERT(initialized_); | 237 ASSERT(initialized_); |
| 238 ASSERT(worker_thread_ == rtc::Thread::Current()); | 238 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 239 ASSERT(nullptr != media_controller); | 239 ASSERT(nullptr != media_controller); |
| 240 | |
| 240 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 241 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
| 241 media_controller->call_w(), media_controller->config(), options); | 242 media_controller->call_w(), media_controller->config(), options); |
| 242 if (!media_channel) | 243 if (!media_channel) |
| 243 return nullptr; | 244 return nullptr; |
| 244 | 245 |
| 246 rtc::Thread* signaling_thread = | |
| 247 transport_controller ? transport_controller->signaling_thread() : nullptr; | |
| 245 VoiceChannel* voice_channel = new VoiceChannel( | 248 VoiceChannel* voice_channel = new VoiceChannel( |
| 246 worker_thread_, network_thread_, media_engine_.get(), media_channel, | 249 worker_thread_, network_thread_, signaling_thread, media_engine_.get(), |
| 247 transport_controller, content_name, rtcp, srtp_required); | 250 media_channel, content_name, rtcp, srtp_required); |
| 248 voice_channel->SetCryptoOptions(crypto_options_); | 251 voice_channel->SetCryptoOptions(crypto_options_); |
| 249 if (!voice_channel->Init_w(bundle_transport_name)) { | 252 std::string transport_name = |
| 253 bundle_transport_name ? *bundle_transport_name : content_name; | |
| 254 TransportChannel* rtp_transport = | |
| 255 transport_controller->CreateTransportChannel( | |
| 256 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 257 TransportChannel* rtcp_transport = | |
| 258 rtcp | |
| 259 ? transport_controller->CreateTransportChannel( | |
| 260 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP) | |
| 261 : nullptr; | |
|
Taylor Brandstetter
2017/01/09 22:50:42
Could this code be moved to WebRtcSession? That wo
Zhi Huang
2017/01/12 03:47:46
Done.
| |
| 262 if (!voice_channel->Init_w(rtp_transport, rtcp_transport)) { | |
| 250 delete voice_channel; | 263 delete voice_channel; |
| 251 return nullptr; | 264 return nullptr; |
| 252 } | 265 } |
| 253 voice_channels_.push_back(voice_channel); | 266 voice_channels_.push_back(voice_channel); |
| 254 return voice_channel; | 267 return voice_channel; |
| 255 } | 268 } |
| 256 | 269 |
| 257 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 270 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
| 258 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); | 271 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
| 259 if (voice_channel) { | 272 if (voice_channel) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 const VideoOptions& options) { | 314 const VideoOptions& options) { |
| 302 ASSERT(initialized_); | 315 ASSERT(initialized_); |
| 303 ASSERT(worker_thread_ == rtc::Thread::Current()); | 316 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 304 ASSERT(nullptr != media_controller); | 317 ASSERT(nullptr != media_controller); |
| 305 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 318 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
| 306 media_controller->call_w(), media_controller->config(), options); | 319 media_controller->call_w(), media_controller->config(), options); |
| 307 if (media_channel == NULL) { | 320 if (media_channel == NULL) { |
| 308 return NULL; | 321 return NULL; |
| 309 } | 322 } |
| 310 | 323 |
| 324 rtc::Thread* signaling_thread = | |
| 325 transport_controller ? transport_controller->signaling_thread() : nullptr; | |
| 311 VideoChannel* video_channel = | 326 VideoChannel* video_channel = |
| 312 new VideoChannel(worker_thread_, network_thread_, media_channel, | 327 new VideoChannel(worker_thread_, network_thread_, signaling_thread, |
| 313 transport_controller, content_name, rtcp, srtp_required); | 328 media_channel, content_name, rtcp, srtp_required); |
| 314 video_channel->SetCryptoOptions(crypto_options_); | 329 video_channel->SetCryptoOptions(crypto_options_); |
| 315 if (!video_channel->Init_w(bundle_transport_name)) { | 330 std::string transport_name = |
| 331 bundle_transport_name ? *bundle_transport_name : content_name; | |
| 332 TransportChannel* rtp_transport = | |
| 333 transport_controller->CreateTransportChannel( | |
| 334 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 335 TransportChannel* rtcp_transport = | |
| 336 rtcp | |
| 337 ? transport_controller->CreateTransportChannel( | |
| 338 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP) | |
| 339 : nullptr; | |
| 340 if (!video_channel->Init_w(rtp_transport, rtcp_transport)) { | |
| 316 delete video_channel; | 341 delete video_channel; |
| 317 return NULL; | 342 return NULL; |
| 318 } | 343 } |
| 319 video_channels_.push_back(video_channel); | 344 video_channels_.push_back(video_channel); |
| 320 return video_channel; | 345 return video_channel; |
| 321 } | 346 } |
| 322 | 347 |
| 323 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 348 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
| 324 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); | 349 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
| 325 if (video_channel) { | 350 if (video_channel) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 if (media_controller) { | 398 if (media_controller) { |
| 374 config = media_controller->config(); | 399 config = media_controller->config(); |
| 375 } | 400 } |
| 376 DataMediaChannel* media_channel = | 401 DataMediaChannel* media_channel = |
| 377 data_media_engine_->CreateChannel(data_channel_type, config); | 402 data_media_engine_->CreateChannel(data_channel_type, config); |
| 378 if (!media_channel) { | 403 if (!media_channel) { |
| 379 LOG(LS_WARNING) << "Failed to create data channel of type " | 404 LOG(LS_WARNING) << "Failed to create data channel of type " |
| 380 << data_channel_type; | 405 << data_channel_type; |
| 381 return NULL; | 406 return NULL; |
| 382 } | 407 } |
| 383 | 408 rtc::Thread* signaling_thread = |
| 409 transport_controller ? transport_controller->signaling_thread() : nullptr; | |
| 384 // Only RTP data channels need SRTP. | 410 // Only RTP data channels need SRTP. |
| 385 srtp_required = srtp_required && data_channel_type == DCT_RTP; | 411 srtp_required = srtp_required && data_channel_type == DCT_RTP; |
| 386 DataChannel* data_channel = | 412 DataChannel* data_channel = |
| 387 new DataChannel(worker_thread_, network_thread_, media_channel, | 413 new DataChannel(worker_thread_, network_thread_, signaling_thread, |
| 388 transport_controller, content_name, rtcp, srtp_required); | 414 media_channel, content_name, rtcp, srtp_required); |
| 415 std::string transport_name = | |
| 416 bundle_transport_name ? *bundle_transport_name : content_name; | |
| 417 TransportChannel* rtp_transport = | |
| 418 transport_controller->CreateTransportChannel( | |
| 419 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 420 TransportChannel* rtcp_transport = | |
| 421 rtcp | |
| 422 ? transport_controller->CreateTransportChannel( | |
| 423 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP) | |
| 424 : nullptr; | |
| 389 data_channel->SetCryptoOptions(crypto_options_); | 425 data_channel->SetCryptoOptions(crypto_options_); |
| 390 if (!data_channel->Init_w(bundle_transport_name)) { | 426 if (!data_channel->Init_w(rtp_transport, rtcp_transport)) { |
| 391 LOG(LS_WARNING) << "Failed to init data channel."; | 427 LOG(LS_WARNING) << "Failed to init data channel."; |
| 392 delete data_channel; | 428 delete data_channel; |
| 393 return NULL; | 429 return NULL; |
| 394 } | 430 } |
| 395 data_channels_.push_back(data_channel); | 431 data_channels_.push_back(data_channel); |
| 396 return data_channel; | 432 return data_channel; |
| 397 } | 433 } |
| 398 | 434 |
| 399 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 435 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
| 400 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); | 436 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 426 media_engine_.get(), file, max_size_bytes)); | 462 media_engine_.get(), file, max_size_bytes)); |
| 427 } | 463 } |
| 428 | 464 |
| 429 void ChannelManager::StopAecDump() { | 465 void ChannelManager::StopAecDump() { |
| 430 worker_thread_->Invoke<void>( | 466 worker_thread_->Invoke<void>( |
| 431 RTC_FROM_HERE, | 467 RTC_FROM_HERE, |
| 432 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 468 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
| 433 } | 469 } |
| 434 | 470 |
| 435 } // namespace cricket | 471 } // namespace cricket |
| OLD | NEW |