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

Side by Side Diff: webrtc/pc/channelmanager.cc

Issue 1528843005: Add support for GCM cipher suites from RFC 7714. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More feedback from Matt Created 4 years, 7 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
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DataEngineInterface* dme, 59 DataEngineInterface* dme,
60 rtc::Thread* worker_thread) { 60 rtc::Thread* worker_thread) {
61 media_engine_.reset(me); 61 media_engine_.reset(me);
62 data_media_engine_.reset(dme); 62 data_media_engine_.reset(dme);
63 initialized_ = false; 63 initialized_ = false;
64 main_thread_ = rtc::Thread::Current(); 64 main_thread_ = rtc::Thread::Current();
65 worker_thread_ = worker_thread; 65 worker_thread_ = worker_thread;
66 audio_output_volume_ = kNotSetOutputVolume; 66 audio_output_volume_ = kNotSetOutputVolume;
67 capturing_ = false; 67 capturing_ = false;
68 enable_rtx_ = false; 68 enable_rtx_ = false;
69 crypto_options_ = rtc::CryptoOptions::NoGcm();
69 } 70 }
70 71
71 ChannelManager::~ChannelManager() { 72 ChannelManager::~ChannelManager() {
72 if (initialized_) { 73 if (initialized_) {
73 Terminate(); 74 Terminate();
74 // If srtp is initialized (done by the Channel) then we must call 75 // If srtp is initialized (done by the Channel) then we must call
75 // srtp_shutdown to free all crypto kernel lists. But we need to make sure 76 // srtp_shutdown to free all crypto kernel lists. But we need to make sure
76 // shutdown always called at the end, after channels are destroyed. 77 // shutdown always called at the end, after channels are destroyed.
77 // ChannelManager d'tor is always called last, it's safe place to call 78 // ChannelManager d'tor is always called last, it's safe place to call
78 // shutdown. 79 // shutdown.
(...skipping 13 matching lines...) Expand all
92 // app. 93 // app.
93 if (!initialized_) { 94 if (!initialized_) {
94 enable_rtx_ = enable; 95 enable_rtx_ = enable;
95 return true; 96 return true;
96 } else { 97 } else {
97 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; 98 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!";
98 return false; 99 return false;
99 } 100 }
100 } 101 }
101 102
103 bool ChannelManager::SetCryptoOptions(
104 const rtc::CryptoOptions& crypto_options) {
105 return worker_thread_->Invoke<bool>(Bind(
106 &ChannelManager::SetCryptoOptions_w, this, crypto_options));
107 }
108
109 bool ChannelManager::SetCryptoOptions_w(
110 const rtc::CryptoOptions& crypto_options) {
111 if (!video_channels_.empty() || !voice_channels_.empty() ||
112 !data_channels_.empty()) {
113 LOG(LS_WARNING) << "Not changing crypto options in existing channels.";
114 }
115 crypto_options_ = crypto_options;
116 return true;
117 }
118
102 void ChannelManager::GetSupportedAudioCodecs( 119 void ChannelManager::GetSupportedAudioCodecs(
103 std::vector<AudioCodec>* codecs) const { 120 std::vector<AudioCodec>* codecs) const {
104 codecs->clear(); 121 codecs->clear();
105 122
106 for (std::vector<AudioCodec>::const_iterator it = 123 for (std::vector<AudioCodec>::const_iterator it =
107 media_engine_->audio_codecs().begin(); 124 media_engine_->audio_codecs().begin();
108 it != media_engine_->audio_codecs().end(); ++it) { 125 it != media_engine_->audio_codecs().end(); ++it) {
109 codecs->push_back(*it); 126 codecs->push_back(*it);
110 } 127 }
111 } 128 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ASSERT(worker_thread_ == rtc::Thread::Current()); 240 ASSERT(worker_thread_ == rtc::Thread::Current());
224 ASSERT(nullptr != media_controller); 241 ASSERT(nullptr != media_controller);
225 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( 242 VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
226 media_controller->call_w(), media_controller->config(), options); 243 media_controller->call_w(), media_controller->config(), options);
227 if (!media_channel) 244 if (!media_channel)
228 return nullptr; 245 return nullptr;
229 246
230 VoiceChannel* voice_channel = 247 VoiceChannel* voice_channel =
231 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, 248 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel,
232 transport_controller, content_name, rtcp); 249 transport_controller, content_name, rtcp);
250 voice_channel->SetCryptoOptions(crypto_options_);
233 if (!voice_channel->Init()) { 251 if (!voice_channel->Init()) {
234 delete voice_channel; 252 delete voice_channel;
235 return nullptr; 253 return nullptr;
236 } 254 }
237 voice_channels_.push_back(voice_channel); 255 voice_channels_.push_back(voice_channel);
238 return voice_channel; 256 return voice_channel;
239 } 257 }
240 258
241 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 259 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
242 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); 260 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ASSERT(worker_thread_ == rtc::Thread::Current()); 299 ASSERT(worker_thread_ == rtc::Thread::Current());
282 ASSERT(nullptr != media_controller); 300 ASSERT(nullptr != media_controller);
283 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( 301 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
284 media_controller->call_w(), media_controller->config(), options); 302 media_controller->call_w(), media_controller->config(), options);
285 if (media_channel == NULL) { 303 if (media_channel == NULL) {
286 return NULL; 304 return NULL;
287 } 305 }
288 306
289 VideoChannel* video_channel = new VideoChannel( 307 VideoChannel* video_channel = new VideoChannel(
290 worker_thread_, media_channel, transport_controller, content_name, rtcp); 308 worker_thread_, media_channel, transport_controller, content_name, rtcp);
309 video_channel->SetCryptoOptions(crypto_options_);
291 if (!video_channel->Init()) { 310 if (!video_channel->Init()) {
292 delete video_channel; 311 delete video_channel;
293 return NULL; 312 return NULL;
294 } 313 }
295 video_channels_.push_back(video_channel); 314 video_channels_.push_back(video_channel);
296 return video_channel; 315 return video_channel;
297 } 316 }
298 317
299 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 318 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
300 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); 319 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( 358 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(
340 data_channel_type); 359 data_channel_type);
341 if (!media_channel) { 360 if (!media_channel) {
342 LOG(LS_WARNING) << "Failed to create data channel of type " 361 LOG(LS_WARNING) << "Failed to create data channel of type "
343 << data_channel_type; 362 << data_channel_type;
344 return NULL; 363 return NULL;
345 } 364 }
346 365
347 DataChannel* data_channel = new DataChannel( 366 DataChannel* data_channel = new DataChannel(
348 worker_thread_, media_channel, transport_controller, content_name, rtcp); 367 worker_thread_, media_channel, transport_controller, content_name, rtcp);
368 data_channel->SetCryptoOptions(crypto_options_);
349 if (!data_channel->Init()) { 369 if (!data_channel->Init()) {
350 LOG(LS_WARNING) << "Failed to init data channel."; 370 LOG(LS_WARNING) << "Failed to init data channel.";
351 delete data_channel; 371 delete data_channel;
352 return NULL; 372 return NULL;
353 } 373 }
354 data_channels_.push_back(data_channel); 374 data_channels_.push_back(data_channel);
355 return data_channel; 375 return data_channel;
356 } 376 }
357 377
358 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { 378 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return worker_thread_->Invoke<bool>( 437 return worker_thread_->Invoke<bool>(
418 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); 438 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file));
419 } 439 }
420 440
421 void ChannelManager::StopRtcEventLog() { 441 void ChannelManager::StopRtcEventLog() {
422 worker_thread_->Invoke<void>( 442 worker_thread_->Invoke<void>(
423 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); 443 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get()));
424 } 444 }
425 445
426 } // namespace cricket 446 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/mediasession.h » ('j') | webrtc/pc/mediasession.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698