2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-02-06 10:11:25 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-21 13:52:32 +00:00
|
|
|
#include "webrtc/voice_engine/voe_codec_impl.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
#include "webrtc/base/format_macros.h"
|
2015-11-26 04:44:54 -08:00
|
|
|
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
|
2015-10-28 18:17:40 +01:00
|
|
|
#include "webrtc/system_wrappers/include/trace.h"
|
2013-05-21 13:52:32 +00:00
|
|
|
#include "webrtc/voice_engine/channel.h"
|
|
|
|
|
#include "webrtc/voice_engine/include/voe_errors.h"
|
|
|
|
|
#include "webrtc/voice_engine/voice_engine_impl.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
namespace webrtc {
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
VoECodec* VoECodec::GetInterface(VoiceEngine* voiceEngine) {
|
2011-07-07 08:21:25 +00:00
|
|
|
#ifndef WEBRTC_VOICE_ENGINE_CODEC_API
|
2015-05-04 14:15:32 +02:00
|
|
|
return NULL;
|
2011-07-07 08:21:25 +00:00
|
|
|
#else
|
2015-05-04 14:15:32 +02:00
|
|
|
if (NULL == voiceEngine) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
|
|
|
|
|
s->AddRef();
|
|
|
|
|
return s;
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
VoECodecImpl::VoECodecImpl(voe::SharedData* shared) : _shared(shared) {
|
|
|
|
|
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"VoECodecImpl() - ctor");
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
VoECodecImpl::~VoECodecImpl() {
|
|
|
|
|
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"~VoECodecImpl() - dtor");
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::NumOfCodecs() {
|
|
|
|
|
// Number of supported codecs in the ACM
|
|
|
|
|
uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
|
|
|
|
|
return (nSupportedCodecs);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::GetCodec(int index, CodecInst& codec) {
|
2015-11-19 11:08:29 -08:00
|
|
|
if (AudioCodingModule::Codec(index, &codec) == -1) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_INVALID_LISTNR, kTraceError,
|
|
|
|
|
"GetCodec() invalid index");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetSendCodec(channel=%d, codec)", channel);
|
|
|
|
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"codec: plname=%s, pacsize=%d, plfreq=%d, pltype=%d, "
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
"channels=%" PRIuS ", rate=%d",
|
2015-05-04 14:15:32 +02:00
|
|
|
codec.plname, codec.pacsize, codec.plfreq, codec.pltype,
|
|
|
|
|
codec.channels, codec.rate);
|
|
|
|
|
if (!_shared->statistics().Initialized()) {
|
|
|
|
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// External sanity checks performed outside the ACM
|
2015-11-19 11:08:29 -08:00
|
|
|
if ((STR_CASE_CMP(codec.plname, "L16") == 0) && (codec.pacsize >= 960)) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
|
|
|
|
"SetSendCodec() invalid L16 packet size");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
if (!STR_CASE_CMP(codec.plname, "CN") ||
|
|
|
|
|
!STR_CASE_CMP(codec.plname, "TELEPHONE-EVENT") ||
|
|
|
|
|
!STR_CASE_CMP(codec.plname, "RED")) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
|
|
|
|
"SetSendCodec() invalid codec name");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
if ((codec.channels != 1) && (codec.channels != 2)) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
|
|
|
|
"SetSendCodec() invalid number of channels");
|
|
|
|
|
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,
|
|
|
|
|
"GetSendCodec() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
if (!AudioCodingModule::IsCodecValid(codec)) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
|
|
|
|
|
"SetSendCodec() invalid codec");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
if (channelPtr->SetSendCodec(codec) != 0) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_CANNOT_SET_SEND_CODEC, kTraceError,
|
|
|
|
|
"SetSendCodec() failed to set send codec");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::GetSendCodec(int channel, CodecInst& codec) {
|
|
|
|
|
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,
|
|
|
|
|
"GetSendCodec() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
if (channelPtr->GetSendCodec(codec) != 0) {
|
2015-05-04 14:15:32 +02:00
|
|
|
_shared->SetLastError(VE_CANNOT_GET_SEND_CODEC, kTraceError,
|
|
|
|
|
"GetSendCodec() failed to get send codec");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-29 16:03:33 +02:00
|
|
|
int VoECodecImpl::SetBitRate(int channel, int bitrate_bps) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetBitRate(bitrate_bps=%d)", bitrate_bps);
|
|
|
|
|
if (!_shared->statistics().Initialized()) {
|
|
|
|
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
_shared->channel_manager().GetChannel(channel).channel()->SetBitRate(
|
|
|
|
|
bitrate_bps);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::GetRecCodec(int channel, CodecInst& codec) {
|
|
|
|
|
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,
|
|
|
|
|
"GetRecCodec() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-11-19 11:08:29 -08:00
|
|
|
return channelPtr->GetRecCodec(codec);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetRecPayloadType(channel=%d, codec)", channel);
|
|
|
|
|
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
"codec: plname=%s, plfreq=%d, pltype=%d, channels=%" PRIuS ", "
|
2015-05-04 14:15:32 +02:00
|
|
|
"pacsize=%d, rate=%d",
|
|
|
|
|
codec.plname, codec.plfreq, codec.pltype, codec.channels,
|
|
|
|
|
codec.pacsize, codec.rate);
|
|
|
|
|
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,
|
|
|
|
|
"GetRecPayloadType() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->SetRecPayloadType(codec);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec) {
|
|
|
|
|
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,
|
|
|
|
|
"GetRecPayloadType() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->GetRecPayloadType(codec);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::SetSendCNPayloadType(int channel,
|
|
|
|
|
int type,
|
|
|
|
|
PayloadFrequencies frequency) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetSendCNPayloadType(channel=%d, type=%d, frequency=%d)",
|
|
|
|
|
channel, type, frequency);
|
|
|
|
|
if (!_shared->statistics().Initialized()) {
|
|
|
|
|
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type < 96 || type > 127) {
|
|
|
|
|
// Only allow dynamic range: 96 to 127
|
|
|
|
|
_shared->SetLastError(VE_INVALID_PLTYPE, kTraceError,
|
|
|
|
|
"SetSendCNPayloadType() invalid payload type");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if ((frequency != kFreq16000Hz) && (frequency != kFreq32000Hz)) {
|
|
|
|
|
// It is not possible to modify the payload type for CN/8000.
|
|
|
|
|
// We only allow modification of the CN payload type for CN/16000
|
|
|
|
|
// and CN/32000.
|
|
|
|
|
_shared->SetLastError(VE_INVALID_PLFREQ, kTraceError,
|
|
|
|
|
"SetSendCNPayloadType() invalid payload frequency");
|
|
|
|
|
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,
|
|
|
|
|
"SetSendCNPayloadType() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->SetSendCNPayloadType(type, frequency);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2014-05-28 09:52:06 +00:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->SetCodecFECStatus(enable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int VoECodecImpl::GetFECStatus(int channel, bool& enabled) {
|
|
|
|
|
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,
|
|
|
|
|
"GetFECStatus() failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
enabled = channelPtr->GetCodecFECStatus();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::SetVADStatus(int channel,
|
|
|
|
|
bool enable,
|
|
|
|
|
VadModes mode,
|
|
|
|
|
bool disableDTX) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetVADStatus(channel=%i, enable=%i, mode=%i, disableDTX=%i)",
|
|
|
|
|
channel, enable, mode, disableDTX);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
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,
|
|
|
|
|
"SetVADStatus failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ACMVADMode vadMode(VADNormal);
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case kVadConventional:
|
|
|
|
|
vadMode = VADNormal;
|
|
|
|
|
break;
|
|
|
|
|
case kVadAggressiveLow:
|
|
|
|
|
vadMode = VADLowBitrate;
|
|
|
|
|
break;
|
|
|
|
|
case kVadAggressiveMid:
|
|
|
|
|
vadMode = VADAggr;
|
|
|
|
|
break;
|
|
|
|
|
case kVadAggressiveHigh:
|
|
|
|
|
vadMode = VADVeryAggr;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->SetVADStatus(enable, vadMode, disableDTX);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
int VoECodecImpl::GetVADStatus(int channel,
|
|
|
|
|
bool& enabled,
|
|
|
|
|
VadModes& mode,
|
|
|
|
|
bool& disabledDTX) {
|
|
|
|
|
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,
|
|
|
|
|
"GetVADStatus failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
ACMVADMode vadMode;
|
|
|
|
|
int ret = channelPtr->GetVADStatus(enabled, vadMode, disabledDTX);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
if (ret != 0) {
|
|
|
|
|
_shared->SetLastError(VE_INVALID_OPERATION, kTraceError,
|
|
|
|
|
"GetVADStatus failed to get VAD mode");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
switch (vadMode) {
|
|
|
|
|
case VADNormal:
|
|
|
|
|
mode = kVadConventional;
|
|
|
|
|
break;
|
|
|
|
|
case VADLowBitrate:
|
|
|
|
|
mode = kVadAggressiveLow;
|
|
|
|
|
break;
|
|
|
|
|
case VADAggr:
|
|
|
|
|
mode = kVadAggressiveMid;
|
|
|
|
|
break;
|
|
|
|
|
case VADVeryAggr:
|
|
|
|
|
mode = kVadAggressiveHigh;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-04 14:15:32 +02:00
|
|
|
return 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2014-09-03 12:28:06 +00:00
|
|
|
int VoECodecImpl::SetOpusMaxPlaybackRate(int channel, int frequency_hz) {
|
2014-08-12 08:13:33 +00:00
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
2014-09-03 12:28:06 +00:00
|
|
|
"SetOpusMaxPlaybackRate(channel=%d, frequency_hz=%d)", channel,
|
|
|
|
|
frequency_hz);
|
2014-08-12 08:13:33 +00:00
|
|
|
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,
|
2014-09-03 12:28:06 +00:00
|
|
|
"SetOpusMaxPlaybackRate failed to locate channel");
|
2014-08-12 08:13:33 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2014-09-03 12:28:06 +00:00
|
|
|
return channelPtr->SetOpusMaxPlaybackRate(frequency_hz);
|
2014-08-12 08:13:33 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-13 09:38:07 +00:00
|
|
|
int VoECodecImpl::SetOpusDtx(int channel, bool enable_dtx) {
|
|
|
|
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
|
|
|
"SetOpusDtx(channel=%d, enable_dtx=%d)", channel, enable_dtx);
|
|
|
|
|
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,
|
|
|
|
|
"SetOpusDtx failed to locate channel");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return channelPtr->SetOpusDtx(enable_dtx);
|
|
|
|
|
}
|
|
|
|
|
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
RtcEventLog* VoECodecImpl::GetEventLog() {
|
|
|
|
|
return _shared->channel_manager().GetEventLog();
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif // WEBRTC_VOICE_ENGINE_CODEC_API
|
|
|
|
|
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace webrtc
|