diff options
Diffstat (limited to 'chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc')
-rw-r--r-- | chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc | 217 |
1 files changed, 28 insertions, 189 deletions
diff --git a/chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc b/chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc index 3acd2bee3fb..4aa0556ea3f 100644 --- a/chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc +++ b/chromium/third_party/webrtc/voice_engine/voe_codec_impl.cc @@ -213,114 +213,6 @@ int VoECodecImpl::GetRecCodec(int channel, CodecInst& codec) return 0; } -int VoECodecImpl::SetAMREncFormat(int channel, AmrMode mode) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetAMREncFormat(channel=%d, mode=%d)", channel, mode); -#ifdef WEBRTC_CODEC_AMR - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetAMREncFormat() failed to locate channel"); - return -1; - } - return channelPtr->SetAMREncFormat(mode); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetAMREncFormat() AMR codec is not supported"); - return -1; -#endif -} - -int VoECodecImpl::SetAMRDecFormat(int channel, AmrMode mode) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetAMRDecFormat(channel=%i, mode=%i)", channel, mode); -#ifdef WEBRTC_CODEC_AMR - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetAMRDecFormat() failed to locate channel"); - return -1; - } - return channelPtr->SetAMRDecFormat(mode); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetAMRDecFormat() AMR codec is not supported"); - return -1; -#endif -} - -int VoECodecImpl::SetAMRWbEncFormat(int channel, AmrMode mode) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetAMRWbEncFormat(channel=%d, mode=%d)", channel, mode); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); -#ifdef WEBRTC_CODEC_AMRWB - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetAMRWbEncFormat() failed to locate channel"); - return -1; - } - return channelPtr->SetAMRWbEncFormat(mode); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetAMRWbEncFormat() AMR-wb codec is not supported"); - return -1; -#endif -} - -int VoECodecImpl::SetAMRWbDecFormat(int channel, AmrMode mode) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetAMRWbDecFormat(channel=%i, mode=%i)", channel, mode); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); -#ifdef WEBRTC_CODEC_AMRWB - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetAMRWbDecFormat() failed to locate channel"); - return -1; - } - return channelPtr->SetAMRWbDecFormat(mode); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetAMRWbDecFormat() AMR-wb codec is not supported"); - return -1; -#endif -} - int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) { WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), @@ -403,92 +295,39 @@ int VoECodecImpl::SetSendCNPayloadType(int channel, int type, return channelPtr->SetSendCNPayloadType(type, frequency); } -int VoECodecImpl::SetISACInitTargetRate(int channel, int rateBps, - bool useFixedFrameSize) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetISACInitTargetRate(channel=%d, rateBps=%d, " - "useFixedFrameSize=%d)", channel, rateBps, useFixedFrameSize); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); -#ifdef WEBRTC_CODEC_ISAC - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetISACInitTargetRate() failed to locate channel"); - return -1; - } - return channelPtr->SetISACInitTargetRate(rateBps, useFixedFrameSize); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetISACInitTargetRate() iSAC codec is not supported"); +int VoECodecImpl::SetFECStatus(int channel, bool enable) { + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetCodecFECStatus(channel=%d, enable=%d)", channel, enable); + if (!_shared->statistics().Initialized()) { + _shared->SetLastError(VE_NOT_INITED, kTraceError); return -1; -#endif -} - -int VoECodecImpl::SetISACMaxRate(int channel, int rateBps) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetISACMaxRate(channel=%d, rateBps=%d)", channel, rateBps); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); -#ifdef WEBRTC_CODEC_ISAC - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetISACMaxRate() failed to locate channel"); - return -1; - } - return channelPtr->SetISACMaxRate(rateBps); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetISACMaxRate() iSAC codec is not supported"); + } + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); + if (channelPtr == NULL) { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "SetCodecFECStatus() failed to locate channel"); return -1; -#endif + } + return channelPtr->SetCodecFECStatus(enable); } -int VoECodecImpl::SetISACMaxPayloadSize(int channel, int sizeBytes) -{ - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetISACMaxPayloadSize(channel=%d, sizeBytes=%d)", channel, - sizeBytes); - ANDROID_NOT_SUPPORTED(_shared->statistics()); - IPHONE_NOT_SUPPORTED(_shared->statistics()); -#ifdef WEBRTC_CODEC_ISAC - if (!_shared->statistics().Initialized()) - { - _shared->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); - voe::Channel* channelPtr = ch.channel(); - if (channelPtr == NULL) - { - _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "SetISACMaxPayloadSize() failed to locate channel"); - return -1; - } - return channelPtr->SetISACMaxPayloadSize(sizeBytes); -#else - _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, - "SetISACMaxPayloadSize() iSAC codec is not supported"); +int VoECodecImpl::GetFECStatus(int channel, bool& enabled) { + WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), + "GetCodecFECStatus(channel=%d)", channel); + if (!_shared->statistics().Initialized()) { + _shared->SetLastError(VE_NOT_INITED, kTraceError); return -1; -#endif - return 0; + } + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); + if (channelPtr == NULL) { + _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, + "GetFECStatus() failed to locate channel"); + return -1; + } + enabled = channelPtr->GetCodecFECStatus(); + return 0; } int VoECodecImpl::SetVADStatus(int channel, bool enable, VadModes mode, |