diff options
author | turaj@webrtc.org <turaj@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-11-13 00:02:48 +0000 |
---|---|---|
committer | turaj@webrtc.org <turaj@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-11-13 00:02:48 +0000 |
commit | b43ac9f2c5d33f5613ad2757e1e62a0aa3c2d34f (patch) | |
tree | 5e7a8f53fbbf644e1efeb4155f630289a8dc4c44 /voice_engine/voe_base_impl.cc | |
parent | 591be3b50428e3c1ea6c29093d1d97e6b3743273 (diff) | |
download | webrtc-b43ac9f2c5d33f5613ad2757e1e62a0aa3c2d34f.tar.gz |
Inject config when creating channels to override the existing one.
BUG=
R=xians@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/3239004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5116 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voe_base_impl.cc')
-rw-r--r-- | voice_engine/voe_base_impl.cc | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/voice_engine/voe_base_impl.cc b/voice_engine/voe_base_impl.cc index c76e06de..402395d4 100644 --- a/voice_engine/voe_base_impl.cc +++ b/voice_engine/voe_base_impl.cc @@ -10,6 +10,7 @@ #include "webrtc/voice_engine/voe_base_impl.h" +#include "webrtc/common.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" #include "webrtc/modules/audio_device/audio_device_impl.h" @@ -520,22 +521,34 @@ int VoEBaseImpl::Terminate() return TerminateInternal(); } -int VoEBaseImpl::CreateChannel() -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "CreateChannel()"); - CriticalSectionScoped cs(_shared->crit_sec()); +int VoEBaseImpl::CreateChannel() { + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "CreateChannel()"); + CriticalSectionScoped cs(_shared->crit_sec()); + if (!_shared->statistics().Initialized()) { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } + voe::ChannelOwner channel_owner = _shared->channel_manager().CreateChannel(); + + return InitializeChannel(&channel_owner); +} - voe::ChannelOwner channel_owner = - _shared->channel_manager().CreateChannel(); +int VoEBaseImpl::CreateChannel(const Config& config) { + CriticalSectionScoped cs(_shared->crit_sec()); + if (!_shared->statistics().Initialized()) { + _shared->SetLastError(VE_NOT_INITED, kTraceError); + return -1; + } + voe::ChannelOwner channel_owner = _shared->channel_manager().CreateChannel( + config); + return InitializeChannel(&channel_owner); +} - if (channel_owner.channel()->SetEngineInformation( +int VoEBaseImpl::InitializeChannel(voe::ChannelOwner* channel_owner) +{ + if (channel_owner->channel()->SetEngineInformation( _shared->statistics(), *_shared->output_mixer(), *_shared->transmit_mixer(), @@ -549,23 +562,23 @@ int VoEBaseImpl::CreateChannel() "CreateChannel() failed to associate engine and channel." " Destroying channel."); _shared->channel_manager() - .DestroyChannel(channel_owner.channel()->ChannelId()); + .DestroyChannel(channel_owner->channel()->ChannelId()); return -1; - } else if (channel_owner.channel()->Init() != 0) { + } else if (channel_owner->channel()->Init() != 0) { _shared->SetLastError( VE_CHANNEL_NOT_CREATED, kTraceError, "CreateChannel() failed to initialize channel. Destroying" " channel."); _shared->channel_manager() - .DestroyChannel(channel_owner.channel()->ChannelId()); + .DestroyChannel(channel_owner->channel()->ChannelId()); return -1; } WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), - "CreateChannel() => %d", channel_owner.channel()->ChannelId()); - return channel_owner.channel()->ChannelId(); + "CreateChannel() => %d", channel_owner->channel()->ChannelId()); + return channel_owner->channel()->ChannelId(); } int VoEBaseImpl::DeleteChannel(int channel) |