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

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

Issue 2537343003: Removing "crypto_required" from MediaContentDescription. (Closed)
Patch Set: Merge with master and clean up CreateDataChannel Created 4 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
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 DestroyVoiceChannel_w(voice_channels_.back()); 211 DestroyVoiceChannel_w(voice_channels_.back());
212 } 212 }
213 } 213 }
214 214
215 VoiceChannel* ChannelManager::CreateVoiceChannel( 215 VoiceChannel* ChannelManager::CreateVoiceChannel(
216 webrtc::MediaControllerInterface* media_controller, 216 webrtc::MediaControllerInterface* media_controller,
217 TransportController* transport_controller, 217 TransportController* transport_controller,
218 const std::string& content_name, 218 const std::string& content_name,
219 const std::string* bundle_transport_name, 219 const std::string* bundle_transport_name,
220 bool rtcp, 220 bool rtcp,
221 bool srtp_required,
221 const AudioOptions& options) { 222 const AudioOptions& options) {
222 return worker_thread_->Invoke<VoiceChannel*>( 223 return worker_thread_->Invoke<VoiceChannel*>(
223 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this, 224 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this,
224 media_controller, transport_controller, content_name, 225 media_controller, transport_controller, content_name,
225 bundle_transport_name, rtcp, options)); 226 bundle_transport_name, rtcp, srtp_required, options));
226 } 227 }
227 228
228 VoiceChannel* ChannelManager::CreateVoiceChannel_w( 229 VoiceChannel* ChannelManager::CreateVoiceChannel_w(
229 webrtc::MediaControllerInterface* media_controller, 230 webrtc::MediaControllerInterface* media_controller,
230 TransportController* transport_controller, 231 TransportController* transport_controller,
231 const std::string& content_name, 232 const std::string& content_name,
232 const std::string* bundle_transport_name, 233 const std::string* bundle_transport_name,
233 bool rtcp, 234 bool rtcp,
235 bool srtp_required,
234 const AudioOptions& options) { 236 const AudioOptions& options) {
235 ASSERT(initialized_); 237 ASSERT(initialized_);
236 ASSERT(worker_thread_ == rtc::Thread::Current()); 238 ASSERT(worker_thread_ == rtc::Thread::Current());
237 ASSERT(nullptr != media_controller); 239 ASSERT(nullptr != media_controller);
238 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( 240 VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
239 media_controller->call_w(), media_controller->config(), options); 241 media_controller->call_w(), media_controller->config(), options);
240 if (!media_channel) 242 if (!media_channel)
241 return nullptr; 243 return nullptr;
242 244
243 VoiceChannel* voice_channel = 245 VoiceChannel* voice_channel = new VoiceChannel(
244 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), 246 worker_thread_, network_thread_, media_engine_.get(), media_channel,
245 media_channel, transport_controller, content_name, rtcp); 247 transport_controller, content_name, rtcp, srtp_required);
246 voice_channel->SetCryptoOptions(crypto_options_); 248 voice_channel->SetCryptoOptions(crypto_options_);
247 if (!voice_channel->Init_w(bundle_transport_name)) { 249 if (!voice_channel->Init_w(bundle_transport_name)) {
248 delete voice_channel; 250 delete voice_channel;
249 return nullptr; 251 return nullptr;
250 } 252 }
251 voice_channels_.push_back(voice_channel); 253 voice_channels_.push_back(voice_channel);
252 return voice_channel; 254 return voice_channel;
253 } 255 }
254 256
255 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 257 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
(...skipping 18 matching lines...) Expand all
274 voice_channels_.erase(it); 276 voice_channels_.erase(it);
275 delete voice_channel; 277 delete voice_channel;
276 } 278 }
277 279
278 VideoChannel* ChannelManager::CreateVideoChannel( 280 VideoChannel* ChannelManager::CreateVideoChannel(
279 webrtc::MediaControllerInterface* media_controller, 281 webrtc::MediaControllerInterface* media_controller,
280 TransportController* transport_controller, 282 TransportController* transport_controller,
281 const std::string& content_name, 283 const std::string& content_name,
282 const std::string* bundle_transport_name, 284 const std::string* bundle_transport_name,
283 bool rtcp, 285 bool rtcp,
286 bool srtp_required,
284 const VideoOptions& options) { 287 const VideoOptions& options) {
285 return worker_thread_->Invoke<VideoChannel*>( 288 return worker_thread_->Invoke<VideoChannel*>(
286 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this, 289 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this,
287 media_controller, transport_controller, content_name, 290 media_controller, transport_controller, content_name,
288 bundle_transport_name, rtcp, options)); 291 bundle_transport_name, rtcp, srtp_required, options));
289 } 292 }
290 293
291 VideoChannel* ChannelManager::CreateVideoChannel_w( 294 VideoChannel* ChannelManager::CreateVideoChannel_w(
292 webrtc::MediaControllerInterface* media_controller, 295 webrtc::MediaControllerInterface* media_controller,
293 TransportController* transport_controller, 296 TransportController* transport_controller,
294 const std::string& content_name, 297 const std::string& content_name,
295 const std::string* bundle_transport_name, 298 const std::string* bundle_transport_name,
296 bool rtcp, 299 bool rtcp,
300 bool srtp_required,
297 const VideoOptions& options) { 301 const VideoOptions& options) {
298 ASSERT(initialized_); 302 ASSERT(initialized_);
299 ASSERT(worker_thread_ == rtc::Thread::Current()); 303 ASSERT(worker_thread_ == rtc::Thread::Current());
300 ASSERT(nullptr != media_controller); 304 ASSERT(nullptr != media_controller);
301 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( 305 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
302 media_controller->call_w(), media_controller->config(), options); 306 media_controller->call_w(), media_controller->config(), options);
303 if (media_channel == NULL) { 307 if (media_channel == NULL) {
304 return NULL; 308 return NULL;
305 } 309 }
306 310
307 VideoChannel* video_channel = 311 VideoChannel* video_channel =
308 new VideoChannel(worker_thread_, network_thread_, media_channel, 312 new VideoChannel(worker_thread_, network_thread_, media_channel,
309 transport_controller, content_name, rtcp); 313 transport_controller, content_name, rtcp, srtp_required);
310 video_channel->SetCryptoOptions(crypto_options_); 314 video_channel->SetCryptoOptions(crypto_options_);
311 if (!video_channel->Init_w(bundle_transport_name)) { 315 if (!video_channel->Init_w(bundle_transport_name)) {
312 delete video_channel; 316 delete video_channel;
313 return NULL; 317 return NULL;
314 } 318 }
315 video_channels_.push_back(video_channel); 319 video_channels_.push_back(video_channel);
316 return video_channel; 320 return video_channel;
317 } 321 }
318 322
319 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 323 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
(...skipping 14 matching lines...) Expand all
334 video_channels_.end(), video_channel); 338 video_channels_.end(), video_channel);
335 ASSERT(it != video_channels_.end()); 339 ASSERT(it != video_channels_.end());
336 if (it == video_channels_.end()) 340 if (it == video_channels_.end())
337 return; 341 return;
338 342
339 video_channels_.erase(it); 343 video_channels_.erase(it);
340 delete video_channel; 344 delete video_channel;
341 } 345 }
342 346
343 DataChannel* ChannelManager::CreateDataChannel( 347 DataChannel* ChannelManager::CreateDataChannel(
348 webrtc::MediaControllerInterface* media_controller,
344 TransportController* transport_controller, 349 TransportController* transport_controller,
345 const std::string& content_name, 350 const std::string& content_name,
346 const std::string* bundle_transport_name, 351 const std::string* bundle_transport_name,
347 bool rtcp, 352 bool rtcp,
348 DataChannelType channel_type) { 353 bool srtp_required,
349 return CreateDataChannel(transport_controller, nullptr, content_name,
350 bundle_transport_name, rtcp, channel_type);
351 }
352
353 DataChannel* ChannelManager::CreateDataChannel(
354 TransportController* transport_controller,
355 webrtc::MediaControllerInterface* media_controller,
356 const std::string& content_name,
357 const std::string* bundle_transport_name,
358 bool rtcp,
359 DataChannelType channel_type) { 354 DataChannelType channel_type) {
360 return worker_thread_->Invoke<DataChannel*>( 355 return worker_thread_->Invoke<DataChannel*>(
361 RTC_FROM_HERE, 356 RTC_FROM_HERE,
362 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, 357 Bind(&ChannelManager::CreateDataChannel_w, this, media_controller,
363 content_name, bundle_transport_name, rtcp, channel_type, 358 transport_controller, content_name, bundle_transport_name, rtcp,
364 media_controller)); 359 srtp_required, channel_type));
365 } 360 }
366 361
367 DataChannel* ChannelManager::CreateDataChannel_w( 362 DataChannel* ChannelManager::CreateDataChannel_w(
363 webrtc::MediaControllerInterface* media_controller,
368 TransportController* transport_controller, 364 TransportController* transport_controller,
369 const std::string& content_name, 365 const std::string& content_name,
370 const std::string* bundle_transport_name, 366 const std::string* bundle_transport_name,
371 bool rtcp, 367 bool rtcp,
372 DataChannelType data_channel_type, 368 bool srtp_required,
373 webrtc::MediaControllerInterface* media_controller) { 369 DataChannelType data_channel_type) {
374 // This is ok to alloc from a thread other than the worker thread. 370 // This is ok to alloc from a thread other than the worker thread.
375 ASSERT(initialized_); 371 ASSERT(initialized_);
376 MediaConfig config; 372 MediaConfig config;
377 if (media_controller) { 373 if (media_controller) {
378 config = media_controller->config(); 374 config = media_controller->config();
379 } 375 }
380 DataMediaChannel* media_channel = 376 DataMediaChannel* media_channel =
381 data_media_engine_->CreateChannel(data_channel_type, config); 377 data_media_engine_->CreateChannel(data_channel_type, config);
382 if (!media_channel) { 378 if (!media_channel) {
383 LOG(LS_WARNING) << "Failed to create data channel of type " 379 LOG(LS_WARNING) << "Failed to create data channel of type "
384 << data_channel_type; 380 << data_channel_type;
385 return NULL; 381 return NULL;
386 } 382 }
387 383
384 // Only RTP data channels need SRTP.
385 srtp_required = srtp_required && data_channel_type == DCT_RTP;
388 DataChannel* data_channel = 386 DataChannel* data_channel =
389 new DataChannel(worker_thread_, network_thread_, media_channel, 387 new DataChannel(worker_thread_, network_thread_, media_channel,
390 transport_controller, content_name, rtcp); 388 transport_controller, content_name, rtcp, srtp_required);
391 data_channel->SetCryptoOptions(crypto_options_); 389 data_channel->SetCryptoOptions(crypto_options_);
392 if (!data_channel->Init_w(bundle_transport_name)) { 390 if (!data_channel->Init_w(bundle_transport_name)) {
393 LOG(LS_WARNING) << "Failed to init data channel."; 391 LOG(LS_WARNING) << "Failed to init data channel.";
394 delete data_channel; 392 delete data_channel;
395 return NULL; 393 return NULL;
396 } 394 }
397 data_channels_.push_back(data_channel); 395 data_channels_.push_back(data_channel);
398 return data_channel; 396 return data_channel;
399 } 397 }
400 398
(...skipping 27 matching lines...) Expand all
428 media_engine_.get(), file, max_size_bytes)); 426 media_engine_.get(), file, max_size_bytes));
429 } 427 }
430 428
431 void ChannelManager::StopAecDump() { 429 void ChannelManager::StopAecDump() {
432 worker_thread_->Invoke<void>( 430 worker_thread_->Invoke<void>(
433 RTC_FROM_HERE, 431 RTC_FROM_HERE,
434 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); 432 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
435 } 433 }
436 434
437 } // namespace cricket 435 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698