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

Side by Side Diff: talk/session/media/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: Updates after feedback from Peter Created 5 years 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 media_engine_.reset(me); 99 media_engine_.reset(me);
100 data_media_engine_.reset(dme); 100 data_media_engine_.reset(dme);
101 capture_manager_.reset(cm); 101 capture_manager_.reset(cm);
102 initialized_ = false; 102 initialized_ = false;
103 main_thread_ = rtc::Thread::Current(); 103 main_thread_ = rtc::Thread::Current();
104 worker_thread_ = worker_thread; 104 worker_thread_ = worker_thread;
105 audio_output_volume_ = kNotSetOutputVolume; 105 audio_output_volume_ = kNotSetOutputVolume;
106 local_renderer_ = NULL; 106 local_renderer_ = NULL;
107 capturing_ = false; 107 capturing_ = false;
108 enable_rtx_ = false; 108 enable_rtx_ = false;
109 enable_gcm_crypto_suites_ = false;
109 110
110 capture_manager_->SignalCapturerStateChange.connect( 111 capture_manager_->SignalCapturerStateChange.connect(
111 this, &ChannelManager::OnVideoCaptureStateChange); 112 this, &ChannelManager::OnVideoCaptureStateChange);
112 } 113 }
113 114
114 ChannelManager::~ChannelManager() { 115 ChannelManager::~ChannelManager() {
115 if (initialized_) { 116 if (initialized_) {
116 Terminate(); 117 Terminate();
117 // If srtp is initialized (done by the Channel) then we must call 118 // If srtp is initialized (done by the Channel) then we must call
118 // srtp_shutdown to free all crypto kernel lists. But we need to make sure 119 // srtp_shutdown to free all crypto kernel lists. But we need to make sure
(...skipping 16 matching lines...) Expand all
135 // app. 136 // app.
136 if (!initialized_) { 137 if (!initialized_) {
137 enable_rtx_ = enable; 138 enable_rtx_ = enable;
138 return true; 139 return true;
139 } else { 140 } else {
140 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; 141 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!";
141 return false; 142 return false;
142 } 143 }
143 } 144 }
144 145
146 bool ChannelManager::SetEnableGcmCryptoSuites(bool enable) {
147 enable_gcm_crypto_suites_ = enable;
148 return true;
149 }
150
145 void ChannelManager::GetSupportedAudioCodecs( 151 void ChannelManager::GetSupportedAudioCodecs(
146 std::vector<AudioCodec>* codecs) const { 152 std::vector<AudioCodec>* codecs) const {
147 codecs->clear(); 153 codecs->clear();
148 154
149 for (std::vector<AudioCodec>::const_iterator it = 155 for (std::vector<AudioCodec>::const_iterator it =
150 media_engine_->audio_codecs().begin(); 156 media_engine_->audio_codecs().begin();
151 it != media_engine_->audio_codecs().end(); ++it) { 157 it != media_engine_->audio_codecs().end(); ++it) {
152 codecs->push_back(*it); 158 codecs->push_back(*it);
153 } 159 }
154 } 160 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ASSERT(worker_thread_ == rtc::Thread::Current()); 274 ASSERT(worker_thread_ == rtc::Thread::Current());
269 ASSERT(nullptr != media_controller); 275 ASSERT(nullptr != media_controller);
270 VoiceMediaChannel* media_channel = 276 VoiceMediaChannel* media_channel =
271 media_engine_->CreateChannel(media_controller->call_w(), options); 277 media_engine_->CreateChannel(media_controller->call_w(), options);
272 if (!media_channel) 278 if (!media_channel)
273 return nullptr; 279 return nullptr;
274 280
275 VoiceChannel* voice_channel = 281 VoiceChannel* voice_channel =
276 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, 282 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel,
277 transport_controller, content_name, rtcp); 283 transport_controller, content_name, rtcp);
284 voice_channel->SetEnableGcmCryptoSuites(enable_gcm_crypto_suites_);
278 if (!voice_channel->Init()) { 285 if (!voice_channel->Init()) {
279 delete voice_channel; 286 delete voice_channel;
280 return nullptr; 287 return nullptr;
281 } 288 }
282 voice_channels_.push_back(voice_channel); 289 voice_channels_.push_back(voice_channel);
283 return voice_channel; 290 return voice_channel;
284 } 291 }
285 292
286 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 293 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
287 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); 294 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 ASSERT(worker_thread_ == rtc::Thread::Current()); 333 ASSERT(worker_thread_ == rtc::Thread::Current());
327 ASSERT(nullptr != media_controller); 334 ASSERT(nullptr != media_controller);
328 VideoMediaChannel* media_channel = 335 VideoMediaChannel* media_channel =
329 media_engine_->CreateVideoChannel(media_controller->call_w(), options); 336 media_engine_->CreateVideoChannel(media_controller->call_w(), options);
330 if (media_channel == NULL) { 337 if (media_channel == NULL) {
331 return NULL; 338 return NULL;
332 } 339 }
333 340
334 VideoChannel* video_channel = new VideoChannel( 341 VideoChannel* video_channel = new VideoChannel(
335 worker_thread_, media_channel, transport_controller, content_name, rtcp); 342 worker_thread_, media_channel, transport_controller, content_name, rtcp);
343 video_channel->SetEnableGcmCryptoSuites(enable_gcm_crypto_suites_);
336 if (!video_channel->Init()) { 344 if (!video_channel->Init()) {
337 delete video_channel; 345 delete video_channel;
338 return NULL; 346 return NULL;
339 } 347 }
340 video_channels_.push_back(video_channel); 348 video_channels_.push_back(video_channel);
341 return video_channel; 349 return video_channel;
342 } 350 }
343 351
344 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 352 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
345 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); 353 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( 392 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(
385 data_channel_type); 393 data_channel_type);
386 if (!media_channel) { 394 if (!media_channel) {
387 LOG(LS_WARNING) << "Failed to create data channel of type " 395 LOG(LS_WARNING) << "Failed to create data channel of type "
388 << data_channel_type; 396 << data_channel_type;
389 return NULL; 397 return NULL;
390 } 398 }
391 399
392 DataChannel* data_channel = new DataChannel( 400 DataChannel* data_channel = new DataChannel(
393 worker_thread_, media_channel, transport_controller, content_name, rtcp); 401 worker_thread_, media_channel, transport_controller, content_name, rtcp);
402 data_channel->SetEnableGcmCryptoSuites(enable_gcm_crypto_suites_);
394 if (!data_channel->Init()) { 403 if (!data_channel->Init()) {
395 LOG(LS_WARNING) << "Failed to init data channel."; 404 LOG(LS_WARNING) << "Failed to init data channel.";
396 delete data_channel; 405 delete data_channel;
397 return NULL; 406 return NULL;
398 } 407 }
399 data_channels_.push_back(data_channel); 408 data_channels_.push_back(data_channel);
400 return data_channel; 409 return data_channel;
401 } 410 }
402 411
403 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { 412 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 return worker_thread_->Invoke<bool>( 573 return worker_thread_->Invoke<bool>(
565 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); 574 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file));
566 } 575 }
567 576
568 void ChannelManager::StopRtcEventLog() { 577 void ChannelManager::StopRtcEventLog() {
569 worker_thread_->Invoke<void>( 578 worker_thread_->Invoke<void>(
570 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); 579 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get()));
571 } 580 }
572 581
573 } // namespace cricket 582 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698