| 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_audio_processing_impl.h" | 11 #include "webrtc/voice_engine/voe_audio_processing_impl.h" |
| 12 | 12 |
| 13 #include "webrtc/base/logging.h" | 13 #include "webrtc/base/logging.h" |
| 14 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 14 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 15 #include "webrtc/system_wrappers/include/trace.h" | 15 #include "webrtc/system_wrappers/include/trace.h" |
| 16 #include "webrtc/voice_engine/channel.h" | 16 #include "webrtc/voice_engine/channel.h" |
| 17 #include "webrtc/voice_engine/include/voe_errors.h" | 17 #include "webrtc/voice_engine/include/voe_errors.h" |
| 18 #include "webrtc/voice_engine/transmit_mixer.h" | 18 #include "webrtc/voice_engine/transmit_mixer.h" |
| 19 #include "webrtc/voice_engine/voice_engine_impl.h" | 19 #include "webrtc/voice_engine/voice_engine_impl.h" |
| 20 | 20 |
| 21 #ifndef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | |
| 22 #error "Deprecated" | |
| 23 #endif | |
| 24 | |
| 25 // TODO(andrew): move to a common place. | 21 // TODO(andrew): move to a common place. |
| 26 #define WEBRTC_VOICE_INIT_CHECK() \ | 22 #define WEBRTC_VOICE_INIT_CHECK() \ |
| 27 do { \ | 23 do { \ |
| 28 if (!_shared->statistics().Initialized()) { \ | 24 if (!_shared->statistics().Initialized()) { \ |
| 29 _shared->SetLastError(VE_NOT_INITED, kTraceError); \ | 25 _shared->SetLastError(VE_NOT_INITED, kTraceError); \ |
| 30 return -1; \ | 26 return -1; \ |
| 31 } \ | 27 } \ |
| 32 } while (0) | 28 } while (0) |
| 33 | 29 |
| 34 #define WEBRTC_VOICE_INIT_CHECK_BOOL() \ | 30 #define WEBRTC_VOICE_INIT_CHECK_BOOL() \ |
| 35 do { \ | 31 do { \ |
| 36 if (!_shared->statistics().Initialized()) { \ | 32 if (!_shared->statistics().Initialized()) { \ |
| 37 _shared->SetLastError(VE_NOT_INITED, kTraceError); \ | 33 _shared->SetLastError(VE_NOT_INITED, kTraceError); \ |
| 38 return false; \ | 34 return false; \ |
| 39 } \ | 35 } \ |
| 40 } while (0) | 36 } while (0) |
| 41 | 37 |
| 42 namespace webrtc { | 38 namespace webrtc { |
| 43 | 39 |
| 44 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 40 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
| 45 static const EcModes kDefaultEcMode = kEcAecm; | 41 static const EcModes kDefaultEcMode = kEcAecm; |
| 46 #else | 42 #else |
| 47 static const EcModes kDefaultEcMode = kEcAec; | 43 static const EcModes kDefaultEcMode = kEcAec; |
| 48 #endif | 44 #endif |
| 49 | 45 |
| 50 VoEAudioProcessing* VoEAudioProcessing::GetInterface(VoiceEngine* voiceEngine) { | 46 VoEAudioProcessing* VoEAudioProcessing::GetInterface(VoiceEngine* voiceEngine) { |
| 51 #ifndef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | |
| 52 return NULL; | |
| 53 #else | |
| 54 if (NULL == voiceEngine) { | 47 if (NULL == voiceEngine) { |
| 55 return NULL; | 48 return NULL; |
| 56 } | 49 } |
| 57 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); | 50 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
| 58 s->AddRef(); | 51 s->AddRef(); |
| 59 return s; | 52 return s; |
| 60 #endif | |
| 61 } | 53 } |
| 62 | 54 |
| 63 #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | |
| 64 VoEAudioProcessingImpl::VoEAudioProcessingImpl(voe::SharedData* shared) | 55 VoEAudioProcessingImpl::VoEAudioProcessingImpl(voe::SharedData* shared) |
| 65 : _isAecMode(kDefaultEcMode == kEcAec), _shared(shared) { | 56 : _isAecMode(kDefaultEcMode == kEcAec), _shared(shared) { |
| 66 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 57 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 67 "VoEAudioProcessingImpl::VoEAudioProcessingImpl() - ctor"); | 58 "VoEAudioProcessingImpl::VoEAudioProcessingImpl() - ctor"); |
| 68 } | 59 } |
| 69 | 60 |
| 70 VoEAudioProcessingImpl::~VoEAudioProcessingImpl() { | 61 VoEAudioProcessingImpl::~VoEAudioProcessingImpl() { |
| 71 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 62 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 72 "VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor"); | 63 "VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor"); |
| 73 } | 64 } |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 764 } |
| 774 | 765 |
| 775 void VoEAudioProcessingImpl::EnableStereoChannelSwapping(bool enable) { | 766 void VoEAudioProcessingImpl::EnableStereoChannelSwapping(bool enable) { |
| 776 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); | 767 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); |
| 777 } | 768 } |
| 778 | 769 |
| 779 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { | 770 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { |
| 780 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); | 771 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); |
| 781 } | 772 } |
| 782 | 773 |
| 783 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | |
| 784 | |
| 785 } // namespace webrtc | 774 } // namespace webrtc |
| OLD | NEW |