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 return true; |
| 115 } |
| 116 |
100 void ChannelManager::GetSupportedAudioSendCodecs( | 117 void ChannelManager::GetSupportedAudioSendCodecs( |
101 std::vector<AudioCodec>* codecs) const { | 118 std::vector<AudioCodec>* codecs) const { |
102 *codecs = media_engine_->audio_send_codecs(); | 119 *codecs = media_engine_->audio_send_codecs(); |
103 } | 120 } |
104 | 121 |
105 void ChannelManager::GetSupportedAudioReceiveCodecs( | 122 void ChannelManager::GetSupportedAudioReceiveCodecs( |
106 std::vector<AudioCodec>* codecs) const { | 123 std::vector<AudioCodec>* codecs) const { |
107 *codecs = media_engine_->audio_recv_codecs(); | 124 *codecs = media_engine_->audio_recv_codecs(); |
108 } | 125 } |
109 | 126 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 ASSERT(worker_thread_ == rtc::Thread::Current()); | 228 ASSERT(worker_thread_ == rtc::Thread::Current()); |
212 ASSERT(nullptr != media_controller); | 229 ASSERT(nullptr != media_controller); |
213 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 230 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
214 media_controller->call_w(), media_controller->config(), options); | 231 media_controller->call_w(), media_controller->config(), options); |
215 if (!media_channel) | 232 if (!media_channel) |
216 return nullptr; | 233 return nullptr; |
217 | 234 |
218 VoiceChannel* voice_channel = | 235 VoiceChannel* voice_channel = |
219 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), | 236 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), |
220 media_channel, transport_controller, content_name, rtcp); | 237 media_channel, transport_controller, content_name, rtcp); |
| 238 voice_channel->SetCryptoOptions(crypto_options_); |
221 if (!voice_channel->Init_w(bundle_transport_name)) { | 239 if (!voice_channel->Init_w(bundle_transport_name)) { |
222 delete voice_channel; | 240 delete voice_channel; |
223 return nullptr; | 241 return nullptr; |
224 } | 242 } |
225 voice_channels_.push_back(voice_channel); | 243 voice_channels_.push_back(voice_channel); |
226 return voice_channel; | 244 return voice_channel; |
227 } | 245 } |
228 | 246 |
229 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 247 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
230 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); | 248 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ASSERT(nullptr != media_controller); | 292 ASSERT(nullptr != media_controller); |
275 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 293 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
276 media_controller->call_w(), media_controller->config(), options); | 294 media_controller->call_w(), media_controller->config(), options); |
277 if (media_channel == NULL) { | 295 if (media_channel == NULL) { |
278 return NULL; | 296 return NULL; |
279 } | 297 } |
280 | 298 |
281 VideoChannel* video_channel = | 299 VideoChannel* video_channel = |
282 new VideoChannel(worker_thread_, network_thread_, media_channel, | 300 new VideoChannel(worker_thread_, network_thread_, media_channel, |
283 transport_controller, content_name, rtcp); | 301 transport_controller, content_name, rtcp); |
| 302 video_channel->SetCryptoOptions(crypto_options_); |
284 if (!video_channel->Init_w(bundle_transport_name)) { | 303 if (!video_channel->Init_w(bundle_transport_name)) { |
285 delete video_channel; | 304 delete video_channel; |
286 return NULL; | 305 return NULL; |
287 } | 306 } |
288 video_channels_.push_back(video_channel); | 307 video_channels_.push_back(video_channel); |
289 return video_channel; | 308 return video_channel; |
290 } | 309 } |
291 | 310 |
292 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 311 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
293 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); | 312 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 data_channel_type); | 356 data_channel_type); |
338 if (!media_channel) { | 357 if (!media_channel) { |
339 LOG(LS_WARNING) << "Failed to create data channel of type " | 358 LOG(LS_WARNING) << "Failed to create data channel of type " |
340 << data_channel_type; | 359 << data_channel_type; |
341 return NULL; | 360 return NULL; |
342 } | 361 } |
343 | 362 |
344 DataChannel* data_channel = | 363 DataChannel* data_channel = |
345 new DataChannel(worker_thread_, network_thread_, media_channel, | 364 new DataChannel(worker_thread_, network_thread_, media_channel, |
346 transport_controller, content_name, rtcp); | 365 transport_controller, content_name, rtcp); |
| 366 data_channel->SetCryptoOptions(crypto_options_); |
347 if (!data_channel->Init_w(bundle_transport_name)) { | 367 if (!data_channel->Init_w(bundle_transport_name)) { |
348 LOG(LS_WARNING) << "Failed to init data channel."; | 368 LOG(LS_WARNING) << "Failed to init data channel."; |
349 delete data_channel; | 369 delete data_channel; |
350 return NULL; | 370 return NULL; |
351 } | 371 } |
352 data_channels_.push_back(data_channel); | 372 data_channels_.push_back(data_channel); |
353 return data_channel; | 373 return data_channel; |
354 } | 374 } |
355 | 375 |
356 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 376 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
(...skipping 26 matching lines...) Expand all Loading... |
383 media_engine_.get(), file, max_size_bytes)); | 403 media_engine_.get(), file, max_size_bytes)); |
384 } | 404 } |
385 | 405 |
386 void ChannelManager::StopAecDump() { | 406 void ChannelManager::StopAecDump() { |
387 worker_thread_->Invoke<void>( | 407 worker_thread_->Invoke<void>( |
388 RTC_FROM_HERE, | 408 RTC_FROM_HERE, |
389 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 409 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
390 } | 410 } |
391 | 411 |
392 } // namespace cricket | 412 } // namespace cricket |
OLD | NEW |