| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 rtc::Thread* worker_thread, | 57 rtc::Thread* worker_thread, |
| 58 rtc::Thread* network_thread) { | 58 rtc::Thread* network_thread) { |
| 59 media_engine_.reset(me); | 59 media_engine_.reset(me); |
| 60 data_media_engine_.reset(dme); | 60 data_media_engine_.reset(dme); |
| 61 initialized_ = false; | 61 initialized_ = false; |
| 62 main_thread_ = rtc::Thread::Current(); | 62 main_thread_ = rtc::Thread::Current(); |
| 63 worker_thread_ = worker_thread; | 63 worker_thread_ = worker_thread; |
| 64 network_thread_ = network_thread; | 64 network_thread_ = network_thread; |
| 65 capturing_ = false; | 65 capturing_ = false; |
| 66 enable_rtx_ = false; | 66 enable_rtx_ = false; |
| 67 crypto_options_ = rtc::CryptoOptions::NoGcm(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 ChannelManager::~ChannelManager() { | 70 ChannelManager::~ChannelManager() { |
| 70 if (initialized_) { | 71 if (initialized_) { |
| 71 Terminate(); | 72 Terminate(); |
| 72 // If srtp is initialized (done by the Channel) then we must call | 73 // If srtp is initialized (done by the Channel) then we must call |
| 73 // srtp_shutdown to free all crypto kernel lists. But we need to make sure | 74 // srtp_shutdown to free all crypto kernel lists. But we need to make sure |
| 74 // shutdown always called at the end, after channels are destroyed. | 75 // shutdown always called at the end, after channels are destroyed. |
| 75 // ChannelManager d'tor is always called last, it's safe place to call | 76 // ChannelManager d'tor is always called last, it's safe place to call |
| 76 // shutdown. | 77 // shutdown. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 90 // app. | 91 // app. |
| 91 if (!initialized_) { | 92 if (!initialized_) { |
| 92 enable_rtx_ = enable; | 93 enable_rtx_ = enable; |
| 93 return true; | 94 return true; |
| 94 } else { | 95 } else { |
| 95 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; | 96 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; |
| 96 return false; | 97 return false; |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 | 100 |
| 101 bool ChannelManager::SetCryptoOptions( |
| 102 const rtc::CryptoOptions& crypto_options) { |
| 103 return worker_thread_->Invoke<bool>(RTC_FROM_HERE, Bind( |
| 104 &ChannelManager::SetCryptoOptions_w, this, crypto_options)); |
| 105 } |
| 106 |
| 107 bool ChannelManager::SetCryptoOptions_w( |
| 108 const rtc::CryptoOptions& crypto_options) { |
| 109 if (!video_channels_.empty() || !voice_channels_.empty() || |
| 110 !data_channels_.empty()) { |
| 111 LOG(LS_WARNING) << "Not changing crypto options in existing channels."; |
| 112 } |
| 113 crypto_options_ = crypto_options; |
| 114 #if defined(ENABLE_EXTERNAL_AUTH) |
| 115 if (crypto_options_.enable_gcm_crypto_suites) { |
| 116 // TODO(jbauch): Re-enable once https://crbug.com/628400 is resolved. |
| 117 crypto_options_.enable_gcm_crypto_suites = false; |
| 118 LOG(LS_WARNING) << "GCM ciphers are not supported with " << |
| 119 "ENABLE_EXTERNAL_AUTH and will be disabled."; |
| 120 } |
| 121 #endif |
| 122 return true; |
| 123 } |
| 124 |
| 100 void ChannelManager::GetSupportedAudioSendCodecs( | 125 void ChannelManager::GetSupportedAudioSendCodecs( |
| 101 std::vector<AudioCodec>* codecs) const { | 126 std::vector<AudioCodec>* codecs) const { |
| 102 *codecs = media_engine_->audio_send_codecs(); | 127 *codecs = media_engine_->audio_send_codecs(); |
| 103 } | 128 } |
| 104 | 129 |
| 105 void ChannelManager::GetSupportedAudioReceiveCodecs( | 130 void ChannelManager::GetSupportedAudioReceiveCodecs( |
| 106 std::vector<AudioCodec>* codecs) const { | 131 std::vector<AudioCodec>* codecs) const { |
| 107 *codecs = media_engine_->audio_recv_codecs(); | 132 *codecs = media_engine_->audio_recv_codecs(); |
| 108 } | 133 } |
| 109 | 134 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ASSERT(worker_thread_ == rtc::Thread::Current()); | 236 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 212 ASSERT(nullptr != media_controller); | 237 ASSERT(nullptr != media_controller); |
| 213 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 238 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
| 214 media_controller->call_w(), media_controller->config(), options); | 239 media_controller->call_w(), media_controller->config(), options); |
| 215 if (!media_channel) | 240 if (!media_channel) |
| 216 return nullptr; | 241 return nullptr; |
| 217 | 242 |
| 218 VoiceChannel* voice_channel = | 243 VoiceChannel* voice_channel = |
| 219 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), | 244 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), |
| 220 media_channel, transport_controller, content_name, rtcp); | 245 media_channel, transport_controller, content_name, rtcp); |
| 246 voice_channel->SetCryptoOptions(crypto_options_); |
| 221 if (!voice_channel->Init_w(bundle_transport_name)) { | 247 if (!voice_channel->Init_w(bundle_transport_name)) { |
| 222 delete voice_channel; | 248 delete voice_channel; |
| 223 return nullptr; | 249 return nullptr; |
| 224 } | 250 } |
| 225 voice_channels_.push_back(voice_channel); | 251 voice_channels_.push_back(voice_channel); |
| 226 return voice_channel; | 252 return voice_channel; |
| 227 } | 253 } |
| 228 | 254 |
| 229 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 255 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
| 230 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); | 256 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ASSERT(nullptr != media_controller); | 300 ASSERT(nullptr != media_controller); |
| 275 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 301 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
| 276 media_controller->call_w(), media_controller->config(), options); | 302 media_controller->call_w(), media_controller->config(), options); |
| 277 if (media_channel == NULL) { | 303 if (media_channel == NULL) { |
| 278 return NULL; | 304 return NULL; |
| 279 } | 305 } |
| 280 | 306 |
| 281 VideoChannel* video_channel = | 307 VideoChannel* video_channel = |
| 282 new VideoChannel(worker_thread_, network_thread_, media_channel, | 308 new VideoChannel(worker_thread_, network_thread_, media_channel, |
| 283 transport_controller, content_name, rtcp); | 309 transport_controller, content_name, rtcp); |
| 310 video_channel->SetCryptoOptions(crypto_options_); |
| 284 if (!video_channel->Init_w(bundle_transport_name)) { | 311 if (!video_channel->Init_w(bundle_transport_name)) { |
| 285 delete video_channel; | 312 delete video_channel; |
| 286 return NULL; | 313 return NULL; |
| 287 } | 314 } |
| 288 video_channels_.push_back(video_channel); | 315 video_channels_.push_back(video_channel); |
| 289 return video_channel; | 316 return video_channel; |
| 290 } | 317 } |
| 291 | 318 |
| 292 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 319 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
| 293 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); | 320 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 data_channel_type); | 364 data_channel_type); |
| 338 if (!media_channel) { | 365 if (!media_channel) { |
| 339 LOG(LS_WARNING) << "Failed to create data channel of type " | 366 LOG(LS_WARNING) << "Failed to create data channel of type " |
| 340 << data_channel_type; | 367 << data_channel_type; |
| 341 return NULL; | 368 return NULL; |
| 342 } | 369 } |
| 343 | 370 |
| 344 DataChannel* data_channel = | 371 DataChannel* data_channel = |
| 345 new DataChannel(worker_thread_, network_thread_, media_channel, | 372 new DataChannel(worker_thread_, network_thread_, media_channel, |
| 346 transport_controller, content_name, rtcp); | 373 transport_controller, content_name, rtcp); |
| 374 data_channel->SetCryptoOptions(crypto_options_); |
| 347 if (!data_channel->Init_w(bundle_transport_name)) { | 375 if (!data_channel->Init_w(bundle_transport_name)) { |
| 348 LOG(LS_WARNING) << "Failed to init data channel."; | 376 LOG(LS_WARNING) << "Failed to init data channel."; |
| 349 delete data_channel; | 377 delete data_channel; |
| 350 return NULL; | 378 return NULL; |
| 351 } | 379 } |
| 352 data_channels_.push_back(data_channel); | 380 data_channels_.push_back(data_channel); |
| 353 return data_channel; | 381 return data_channel; |
| 354 } | 382 } |
| 355 | 383 |
| 356 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 384 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 383 media_engine_.get(), file, max_size_bytes)); | 411 media_engine_.get(), file, max_size_bytes)); |
| 384 } | 412 } |
| 385 | 413 |
| 386 void ChannelManager::StopAecDump() { | 414 void ChannelManager::StopAecDump() { |
| 387 worker_thread_->Invoke<void>( | 415 worker_thread_->Invoke<void>( |
| 388 RTC_FROM_HERE, | 416 RTC_FROM_HERE, |
| 389 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 417 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
| 390 } | 418 } |
| 391 | 419 |
| 392 } // namespace cricket | 420 } // namespace cricket |
| OLD | NEW |