| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 CaptureManager* cm, | 96 CaptureManager* cm, |
| 97 rtc::Thread* worker_thread) { | 97 rtc::Thread* worker_thread) { |
| 98 media_engine_.reset(me); | 98 media_engine_.reset(me); |
| 99 data_media_engine_.reset(dme); | 99 data_media_engine_.reset(dme); |
| 100 capture_manager_.reset(cm); | 100 capture_manager_.reset(cm); |
| 101 initialized_ = false; | 101 initialized_ = false; |
| 102 main_thread_ = rtc::Thread::Current(); | 102 main_thread_ = rtc::Thread::Current(); |
| 103 worker_thread_ = worker_thread; | 103 worker_thread_ = worker_thread; |
| 104 // Get the default audio options from the media engine. | 104 // Get the default audio options from the media engine. |
| 105 audio_options_ = media_engine_->GetAudioOptions(); | 105 audio_options_ = media_engine_->GetAudioOptions(); |
| 106 audio_delay_offset_ = kDefaultAudioDelayOffset; | |
| 107 audio_output_volume_ = kNotSetOutputVolume; | 106 audio_output_volume_ = kNotSetOutputVolume; |
| 108 local_renderer_ = NULL; | 107 local_renderer_ = NULL; |
| 109 capturing_ = false; | 108 capturing_ = false; |
| 110 enable_rtx_ = false; | 109 enable_rtx_ = false; |
| 111 | 110 |
| 112 capture_manager_->SignalCapturerStateChange.connect( | 111 capture_manager_->SignalCapturerStateChange.connect( |
| 113 this, &ChannelManager::OnVideoCaptureStateChange); | 112 this, &ChannelManager::OnVideoCaptureStateChange); |
| 114 } | 113 } |
| 115 | 114 |
| 116 ChannelManager::~ChannelManager() { | 115 ChannelManager::~ChannelManager() { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 &rtc::Thread::SetAllowBlockingCalls, worker_thread_, false)); | 198 &rtc::Thread::SetAllowBlockingCalls, worker_thread_, false)); |
| 200 } | 199 } |
| 201 | 200 |
| 202 initialized_ = worker_thread_->Invoke<bool>(Bind( | 201 initialized_ = worker_thread_->Invoke<bool>(Bind( |
| 203 &ChannelManager::InitMediaEngine_w, this)); | 202 &ChannelManager::InitMediaEngine_w, this)); |
| 204 ASSERT(initialized_); | 203 ASSERT(initialized_); |
| 205 if (!initialized_) { | 204 if (!initialized_) { |
| 206 return false; | 205 return false; |
| 207 } | 206 } |
| 208 | 207 |
| 209 if (!SetAudioOptions(audio_options_, audio_delay_offset_)) { | 208 if (!SetAudioOptions(audio_options_)) { |
| 210 LOG(LS_WARNING) << "Failed to SetAudioOptions with" | 209 LOG(LS_WARNING) << "Failed to SetAudioOptions with options: " |
| 211 << " options: " << audio_options_.ToString() | 210 << audio_options_.ToString(); |
| 212 << " delay: " << audio_delay_offset_; | |
| 213 } | 211 } |
| 214 | 212 |
| 215 // If audio_output_volume_ has been set via SetOutputVolume(), set the | 213 // If audio_output_volume_ has been set via SetOutputVolume(), set the |
| 216 // audio output volume of the engine. | 214 // audio output volume of the engine. |
| 217 if (kNotSetOutputVolume != audio_output_volume_ && | 215 if (kNotSetOutputVolume != audio_output_volume_ && |
| 218 !SetOutputVolume(audio_output_volume_)) { | 216 !SetOutputVolume(audio_output_volume_)) { |
| 219 LOG(LS_WARNING) << "Failed to SetOutputVolume to " | 217 LOG(LS_WARNING) << "Failed to SetOutputVolume to " |
| 220 << audio_output_volume_; | 218 << audio_output_volume_; |
| 221 } | 219 } |
| 222 | 220 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 DataChannels::iterator it = std::find(data_channels_.begin(), | 420 DataChannels::iterator it = std::find(data_channels_.begin(), |
| 423 data_channels_.end(), data_channel); | 421 data_channels_.end(), data_channel); |
| 424 ASSERT(it != data_channels_.end()); | 422 ASSERT(it != data_channels_.end()); |
| 425 if (it == data_channels_.end()) | 423 if (it == data_channels_.end()) |
| 426 return; | 424 return; |
| 427 | 425 |
| 428 data_channels_.erase(it); | 426 data_channels_.erase(it); |
| 429 delete data_channel; | 427 delete data_channel; |
| 430 } | 428 } |
| 431 | 429 |
| 432 bool ChannelManager::SetAudioOptions(const AudioOptions& options, | 430 bool ChannelManager::SetAudioOptions(const AudioOptions& options) { |
| 433 int delay_offset) { | |
| 434 // "Get device ids from DeviceManager" - these are the defaults returned. | 431 // "Get device ids from DeviceManager" - these are the defaults returned. |
| 435 Device in_dev("", -1); | 432 Device in_dev("", -1); |
| 436 Device out_dev("", -1); | 433 Device out_dev("", -1); |
| 437 | 434 |
| 438 // If we're initialized, pass the settings to the media engine. | 435 // If we're initialized, pass the settings to the media engine. |
| 439 bool ret = true; | 436 bool ret = true; |
| 440 if (initialized_) { | 437 if (initialized_) { |
| 441 ret = worker_thread_->Invoke<bool>( | 438 ret = worker_thread_->Invoke<bool>( |
| 442 Bind(&ChannelManager::SetAudioOptions_w, this, | 439 Bind(&ChannelManager::SetAudioOptions_w, this, |
| 443 options, delay_offset, &in_dev, &out_dev)); | 440 options, &in_dev, &out_dev)); |
| 444 } | 441 } |
| 445 | 442 |
| 446 // If all worked well, save the values for use in GetAudioOptions. | 443 // If all worked well, save the values for use in GetAudioOptions. |
| 447 if (ret) { | 444 if (ret) { |
| 448 audio_options_ = options; | 445 audio_options_ = options; |
| 449 audio_delay_offset_ = delay_offset; | |
| 450 } | 446 } |
| 451 return ret; | 447 return ret; |
| 452 } | 448 } |
| 453 | 449 |
| 454 bool ChannelManager::SetAudioOptions_w( | 450 bool ChannelManager::SetAudioOptions_w( |
| 455 const AudioOptions& options, int delay_offset, | 451 const AudioOptions& options, |
| 456 const Device* in_dev, const Device* out_dev) { | 452 const Device* in_dev, const Device* out_dev) { |
| 457 ASSERT(worker_thread_ == rtc::Thread::Current()); | 453 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 458 ASSERT(initialized_); | 454 ASSERT(initialized_); |
| 459 | 455 |
| 460 // Set audio options | 456 // Set audio options |
| 461 bool ret = media_engine_->SetAudioOptions(options); | 457 bool ret = media_engine_->SetAudioOptions(options); |
| 462 | 458 |
| 463 if (ret) { | |
| 464 ret = media_engine_->SetAudioDelayOffset(delay_offset); | |
| 465 } | |
| 466 | |
| 467 // Set the audio devices | 459 // Set the audio devices |
| 468 if (ret) { | 460 if (ret) { |
| 469 ret = media_engine_->SetSoundDevices(in_dev, out_dev); | 461 ret = media_engine_->SetSoundDevices(in_dev, out_dev); |
| 470 } | 462 } |
| 471 | 463 |
| 472 return ret; | 464 return ret; |
| 473 } | 465 } |
| 474 | 466 |
| 475 bool ChannelManager::GetOutputVolume(int* level) { | 467 bool ChannelManager::GetOutputVolume(int* level) { |
| 476 if (!initialized_) { | 468 if (!initialized_) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 names->push_back(devs[i].name); | 633 names->push_back(devs[i].name); |
| 642 } | 634 } |
| 643 } | 635 } |
| 644 | 636 |
| 645 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { | 637 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { |
| 646 return worker_thread_->Invoke<bool>( | 638 return worker_thread_->Invoke<bool>( |
| 647 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); | 639 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); |
| 648 } | 640 } |
| 649 | 641 |
| 650 } // namespace cricket | 642 } // namespace cricket |
| OLD | NEW |