Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include "webrtc/voice_engine/voe_base_impl.h" | 11 #include "webrtc/voice_engine/voe_base_impl.h" |
| 12 | 12 |
| 13 #include "webrtc/base/format_macros.h" | 13 #include "webrtc/base/format_macros.h" |
| 14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
| 15 #include "webrtc/common.h" | |
| 16 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" | 15 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" |
| 17 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | 16 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
| 18 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 17 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
| 19 #include "webrtc/modules/audio_device/audio_device_impl.h" | 18 #include "webrtc/modules/audio_device/audio_device_impl.h" |
| 20 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 19 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 21 #include "webrtc/system_wrappers/include/file_wrapper.h" | 20 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| 22 #include "webrtc/voice_engine/channel.h" | 21 #include "webrtc/voice_engine/channel.h" |
| 23 #include "webrtc/voice_engine/include/voe_errors.h" | 22 #include "webrtc/voice_engine/include/voe_errors.h" |
| 24 #include "webrtc/voice_engine/output_mixer.h" | 23 #include "webrtc/voice_engine/output_mixer.h" |
| 25 #include "webrtc/voice_engine/transmit_mixer.h" | 24 #include "webrtc/voice_engine/transmit_mixer.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 | 347 |
| 349 return shared_->statistics().SetInitialized(); | 348 return shared_->statistics().SetInitialized(); |
| 350 } | 349 } |
| 351 | 350 |
| 352 int VoEBaseImpl::Terminate() { | 351 int VoEBaseImpl::Terminate() { |
| 353 rtc::CritScope cs(shared_->crit_sec()); | 352 rtc::CritScope cs(shared_->crit_sec()); |
| 354 return TerminateInternal(); | 353 return TerminateInternal(); |
| 355 } | 354 } |
| 356 | 355 |
| 357 int VoEBaseImpl::CreateChannel() { | 356 int VoEBaseImpl::CreateChannel() { |
| 357 return CreateChannel(AudioCodingModule::Config()); | |
| 358 } | |
| 359 | |
| 360 int VoEBaseImpl::CreateChannel(const AudioCodingModule::Config& acm_config) { | |
| 358 rtc::CritScope cs(shared_->crit_sec()); | 361 rtc::CritScope cs(shared_->crit_sec()); |
| 359 if (!shared_->statistics().Initialized()) { | 362 if (!shared_->statistics().Initialized()) { |
| 360 shared_->SetLastError(VE_NOT_INITED, kTraceError); | 363 shared_->SetLastError(VE_NOT_INITED, kTraceError); |
| 361 return -1; | 364 return -1; |
| 362 } | 365 } |
| 363 | 366 |
| 367 AudioCodingModule::Config acm_config_copy; | |
|
tommi
2016/09/01 21:02:11
what is this a copy of? should it be acm_config_c
the sun
2016/09/02 07:02:46
Yes, good catch!
| |
| 368 acm_config_copy.decoder_factory = decoder_factory_; | |
| 364 voe::ChannelOwner channel_owner = | 369 voe::ChannelOwner channel_owner = |
| 365 shared_->channel_manager().CreateChannel(decoder_factory_); | 370 shared_->channel_manager().CreateChannel(acm_config_copy); |
| 366 return InitializeChannel(&channel_owner); | 371 return InitializeChannel(&channel_owner); |
| 367 } | 372 } |
| 368 | 373 |
| 369 int VoEBaseImpl::CreateChannel(const Config& config) { | |
| 370 rtc::CritScope cs(shared_->crit_sec()); | |
| 371 if (!shared_->statistics().Initialized()) { | |
| 372 shared_->SetLastError(VE_NOT_INITED, kTraceError); | |
| 373 return -1; | |
| 374 } | |
| 375 voe::ChannelOwner channel_owner = | |
| 376 shared_->channel_manager().CreateChannel(config, decoder_factory_); | |
| 377 return InitializeChannel(&channel_owner); | |
| 378 } | |
| 379 | |
| 380 int VoEBaseImpl::InitializeChannel(voe::ChannelOwner* channel_owner) { | 374 int VoEBaseImpl::InitializeChannel(voe::ChannelOwner* channel_owner) { |
| 381 if (channel_owner->channel()->SetEngineInformation( | 375 if (channel_owner->channel()->SetEngineInformation( |
| 382 shared_->statistics(), *shared_->output_mixer(), | 376 shared_->statistics(), *shared_->output_mixer(), |
| 383 *shared_->transmit_mixer(), *shared_->process_thread(), | 377 *shared_->transmit_mixer(), *shared_->process_thread(), |
| 384 *shared_->audio_device(), voiceEngineObserverPtr_, | 378 *shared_->audio_device(), voiceEngineObserverPtr_, |
| 385 &callbackCritSect_) != 0) { | 379 &callbackCritSect_) != 0) { |
| 386 shared_->SetLastError( | 380 shared_->SetLastError( |
| 387 VE_CHANNEL_NOT_CREATED, kTraceError, | 381 VE_CHANNEL_NOT_CREATED, kTraceError, |
| 388 "CreateChannel() failed to associate engine and channel." | 382 "CreateChannel() failed to associate engine and channel." |
| 389 " Destroying channel."); | 383 " Destroying channel."); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 782 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 789 "AssociateSendChannel() failed to locate accociate_send_channel"); | 783 "AssociateSendChannel() failed to locate accociate_send_channel"); |
| 790 return -1; | 784 return -1; |
| 791 } | 785 } |
| 792 | 786 |
| 793 channel_ptr->set_associate_send_channel(ch); | 787 channel_ptr->set_associate_send_channel(ch); |
| 794 return 0; | 788 return 0; |
| 795 } | 789 } |
| 796 | 790 |
| 797 } // namespace webrtc | 791 } // namespace webrtc |
| OLD | NEW |