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

Side by Side Diff: talk/session/media/channelmanager.cc

Issue 1358413003: Revert of TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « talk/session/media/channelmanager.h ('k') | talk/session/media/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 * 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 DestroyVoiceChannel_w(voice_channels_.back()); 312 DestroyVoiceChannel_w(voice_channels_.back());
313 } 313 }
314 if (!SetCaptureDevice_w(NULL)) { 314 if (!SetCaptureDevice_w(NULL)) {
315 LOG(LS_WARNING) << "failed to delete video capturer"; 315 LOG(LS_WARNING) << "failed to delete video capturer";
316 } 316 }
317 media_engine_->Terminate(); 317 media_engine_->Terminate();
318 } 318 }
319 319
320 VoiceChannel* ChannelManager::CreateVoiceChannel( 320 VoiceChannel* ChannelManager::CreateVoiceChannel(
321 webrtc::MediaControllerInterface* media_controller, 321 webrtc::MediaControllerInterface* media_controller,
322 TransportController* transport_controller, 322 BaseSession* session,
323 const std::string& content_name, 323 const std::string& content_name,
324 bool rtcp, 324 bool rtcp,
325 const AudioOptions& options) { 325 const AudioOptions& options) {
326 return worker_thread_->Invoke<VoiceChannel*>( 326 return worker_thread_->Invoke<VoiceChannel*>(
327 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, 327 Bind(&ChannelManager::CreateVoiceChannel_w,
328 transport_controller, content_name, rtcp, options)); 328 this,
329 media_controller,
330 session,
331 content_name,
332 rtcp,
333 options));
329 } 334 }
330 335
331 VoiceChannel* ChannelManager::CreateVoiceChannel_w( 336 VoiceChannel* ChannelManager::CreateVoiceChannel_w(
332 webrtc::MediaControllerInterface* media_controller, 337 webrtc::MediaControllerInterface* media_controller,
333 TransportController* transport_controller, 338 BaseSession* session,
334 const std::string& content_name, 339 const std::string& content_name,
335 bool rtcp, 340 bool rtcp,
336 const AudioOptions& options) { 341 const AudioOptions& options) {
337 ASSERT(initialized_); 342 ASSERT(initialized_);
338 ASSERT(worker_thread_ == rtc::Thread::Current()); 343 ASSERT(worker_thread_ == rtc::Thread::Current());
339 ASSERT(nullptr != media_controller); 344 ASSERT(nullptr != media_controller);
340 VoiceMediaChannel* media_channel = 345 VoiceMediaChannel* media_channel =
341 media_engine_->CreateChannel(media_controller->call_w(), options); 346 media_engine_->CreateChannel(media_controller->call_w(), options);
342 if (!media_channel) 347 if (!media_channel)
343 return nullptr; 348 return nullptr;
344 349
345 VoiceChannel* voice_channel = 350 VoiceChannel* voice_channel = new VoiceChannel(
346 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, 351 worker_thread_, media_engine_.get(), media_channel,
347 transport_controller, content_name, rtcp); 352 session, content_name, rtcp);
348 if (!voice_channel->Init()) { 353 if (!voice_channel->Init()) {
349 delete voice_channel; 354 delete voice_channel;
350 return nullptr; 355 return nullptr;
351 } 356 }
352 voice_channels_.push_back(voice_channel); 357 voice_channels_.push_back(voice_channel);
353 return voice_channel; 358 return voice_channel;
354 } 359 }
355 360
356 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 361 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
357 if (voice_channel) { 362 if (voice_channel) {
(...skipping 10 matching lines...) Expand all
368 voice_channels_.end(), voice_channel); 373 voice_channels_.end(), voice_channel);
369 ASSERT(it != voice_channels_.end()); 374 ASSERT(it != voice_channels_.end());
370 if (it == voice_channels_.end()) 375 if (it == voice_channels_.end())
371 return; 376 return;
372 voice_channels_.erase(it); 377 voice_channels_.erase(it);
373 delete voice_channel; 378 delete voice_channel;
374 } 379 }
375 380
376 VideoChannel* ChannelManager::CreateVideoChannel( 381 VideoChannel* ChannelManager::CreateVideoChannel(
377 webrtc::MediaControllerInterface* media_controller, 382 webrtc::MediaControllerInterface* media_controller,
378 TransportController* transport_controller, 383 BaseSession* session,
379 const std::string& content_name, 384 const std::string& content_name,
380 bool rtcp, 385 bool rtcp,
381 const VideoOptions& options) { 386 const VideoOptions& options) {
382 return worker_thread_->Invoke<VideoChannel*>( 387 return worker_thread_->Invoke<VideoChannel*>(
383 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, 388 Bind(&ChannelManager::CreateVideoChannel_w,
384 transport_controller, content_name, rtcp, options)); 389 this,
390 media_controller,
391 session,
392 content_name,
393 rtcp,
394 options));
385 } 395 }
386 396
387 VideoChannel* ChannelManager::CreateVideoChannel_w( 397 VideoChannel* ChannelManager::CreateVideoChannel_w(
388 webrtc::MediaControllerInterface* media_controller, 398 webrtc::MediaControllerInterface* media_controller,
389 TransportController* transport_controller, 399 BaseSession* session,
390 const std::string& content_name, 400 const std::string& content_name,
391 bool rtcp, 401 bool rtcp,
392 const VideoOptions& options) { 402 const VideoOptions& options) {
393 ASSERT(initialized_); 403 ASSERT(initialized_);
394 ASSERT(worker_thread_ == rtc::Thread::Current()); 404 ASSERT(worker_thread_ == rtc::Thread::Current());
395 ASSERT(nullptr != media_controller); 405 ASSERT(nullptr != media_controller);
396 VideoMediaChannel* media_channel = 406 VideoMediaChannel* media_channel =
397 media_engine_->CreateVideoChannel(media_controller->call_w(), options); 407 media_engine_->CreateVideoChannel(media_controller->call_w(), options);
398 if (media_channel == NULL) { 408 if (media_channel == NULL)
399 return NULL; 409 return NULL;
400 }
401 410
402 VideoChannel* video_channel = new VideoChannel( 411 VideoChannel* video_channel = new VideoChannel(
403 worker_thread_, media_channel, transport_controller, content_name, rtcp); 412 worker_thread_, media_channel,
413 session, content_name, rtcp);
404 if (!video_channel->Init()) { 414 if (!video_channel->Init()) {
405 delete video_channel; 415 delete video_channel;
406 return NULL; 416 return NULL;
407 } 417 }
408 video_channels_.push_back(video_channel); 418 video_channels_.push_back(video_channel);
409 return video_channel; 419 return video_channel;
410 } 420 }
411 421
412 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 422 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
413 if (video_channel) { 423 if (video_channel) {
(...skipping 10 matching lines...) Expand all
424 video_channels_.end(), video_channel); 434 video_channels_.end(), video_channel);
425 ASSERT(it != video_channels_.end()); 435 ASSERT(it != video_channels_.end());
426 if (it == video_channels_.end()) 436 if (it == video_channels_.end())
427 return; 437 return;
428 438
429 video_channels_.erase(it); 439 video_channels_.erase(it);
430 delete video_channel; 440 delete video_channel;
431 } 441 }
432 442
433 DataChannel* ChannelManager::CreateDataChannel( 443 DataChannel* ChannelManager::CreateDataChannel(
434 TransportController* transport_controller, 444 BaseSession* session, const std::string& content_name,
435 const std::string& content_name, 445 bool rtcp, DataChannelType channel_type) {
436 bool rtcp,
437 DataChannelType channel_type) {
438 return worker_thread_->Invoke<DataChannel*>( 446 return worker_thread_->Invoke<DataChannel*>(
439 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, 447 Bind(&ChannelManager::CreateDataChannel_w, this, session, content_name,
440 content_name, rtcp, channel_type)); 448 rtcp, channel_type));
441 } 449 }
442 450
443 DataChannel* ChannelManager::CreateDataChannel_w( 451 DataChannel* ChannelManager::CreateDataChannel_w(
444 TransportController* transport_controller, 452 BaseSession* session, const std::string& content_name,
445 const std::string& content_name, 453 bool rtcp, DataChannelType data_channel_type) {
446 bool rtcp,
447 DataChannelType data_channel_type) {
448 // This is ok to alloc from a thread other than the worker thread. 454 // This is ok to alloc from a thread other than the worker thread.
449 ASSERT(initialized_); 455 ASSERT(initialized_);
450 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( 456 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(
451 data_channel_type); 457 data_channel_type);
452 if (!media_channel) { 458 if (!media_channel) {
453 LOG(LS_WARNING) << "Failed to create data channel of type " 459 LOG(LS_WARNING) << "Failed to create data channel of type "
454 << data_channel_type; 460 << data_channel_type;
455 return NULL; 461 return NULL;
456 } 462 }
457 463
458 DataChannel* data_channel = new DataChannel( 464 DataChannel* data_channel = new DataChannel(
459 worker_thread_, media_channel, transport_controller, content_name, rtcp); 465 worker_thread_, media_channel,
466 session, content_name, rtcp);
460 if (!data_channel->Init()) { 467 if (!data_channel->Init()) {
461 LOG(LS_WARNING) << "Failed to init data channel."; 468 LOG(LS_WARNING) << "Failed to init data channel.";
462 delete data_channel; 469 delete data_channel;
463 return NULL; 470 return NULL;
464 } 471 }
465 data_channels_.push_back(data_channel); 472 data_channels_.push_back(data_channel);
466 return data_channel; 473 return data_channel;
467 } 474 }
468 475
469 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { 476 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 const VideoFormat& max_format) { 905 const VideoFormat& max_format) {
899 device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format); 906 device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format);
900 } 907 }
901 908
902 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { 909 bool ChannelManager::StartAecDump(rtc::PlatformFile file) {
903 return worker_thread_->Invoke<bool>( 910 return worker_thread_->Invoke<bool>(
904 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); 911 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file));
905 } 912 }
906 913
907 } // namespace cricket 914 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/session/media/channelmanager.h ('k') | talk/session/media/channelmanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698