Revert r4772 "Compile ACM1 and ACM2."

Breaks Android build.

TBR=turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2244004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4777 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2013-09-18 12:34:05 +00:00
parent 40d3fc65f5
commit 1c77dfd521
44 changed files with 679 additions and 140 deletions

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_amr.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_amrwb.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_celt.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -12,7 +12,7 @@
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -17,7 +17,7 @@
// references, where appropriate.
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/system_wrappers/interface/trace.h"
// Includes needed to create the codecs.

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_
#include <string.h>
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/typedefs.h"
// Checks for enabled codecs, we prevent enabling codecs which are not
// compatible.
#if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX))
#error iSAC and iSACFX codecs cannot be enabled at the same time
#endif
namespace webrtc {
namespace acm1 {
// 60 ms is the maximum block size we support. An extra 20 ms is considered
// for safety if process() method is not called when it should be, i.e. we
// accept 20 ms of jitter. 80 ms @ 48 kHz (full-band) stereo is 7680 samples.
#define AUDIO_BUFFER_SIZE_W16 7680
// There is one timestamp per each 10 ms of audio
// the audio buffer, at max, may contain 32 blocks of 10ms
// audio if the sampling frequency is 8000 Hz (80 samples per block).
// Therefore, The size of the buffer where we keep timestamps
// is defined as follows
#define TIMESTAMP_BUFFER_SIZE_W32 (AUDIO_BUFFER_SIZE_W16/80)
// The maximum size of a payload, that is 60 ms of PCM-16 @ 32 kHz stereo
#define MAX_PAYLOAD_SIZE_BYTE 7680
// General codec specific defines
const int kIsacWbDefaultRate = 32000;
const int kIsacSwbDefaultRate = 56000;
const int kIsacPacSize480 = 480;
const int kIsacPacSize960 = 960;
const int kIsacPacSize1440 = 1440;
// An encoded bit-stream is labeled by one of the following enumerators.
//
// kNoEncoding : There has been no encoding.
// kActiveNormalEncoded : Active audio frame coded by the codec.
// kPassiveNormalEncoded : Passive audio frame coded by the codec.
// kPassiveDTXNB : Passive audio frame coded by narrow-band CN.
// kPassiveDTXWB : Passive audio frame coded by wide-band CN.
// kPassiveDTXSWB : Passive audio frame coded by super-wide-band CN.
// kPassiveDTXFB : Passive audio frame coded by full-band CN.
enum WebRtcACMEncodingType {
kNoEncoding,
kActiveNormalEncoded,
kPassiveNormalEncoded,
kPassiveDTXNB,
kPassiveDTXWB,
kPassiveDTXSWB,
kPassiveDTXFB
};
// A structure which contains codec parameters. For instance, used when
// initializing encoder and decoder.
//
// codec_inst: c.f. common_types.h
// enable_dtx: set true to enable DTX. If codec does not have
// internal DTX, this will enable VAD.
// enable_vad: set true to enable VAD.
// vad_mode: VAD mode, c.f. audio_coding_module_typedefs.h
// for possible values.
struct WebRtcACMCodecParams {
CodecInst codec_inst;
bool enable_dtx;
bool enable_vad;
ACMVADMode vad_mode;
};
// A structure that encapsulates audio buffer and related parameters
// used for synchronization of audio of two ACMs.
//
// in_audio: same as ACMGenericCodec::in_audio_
// in_audio_ix_read: same as ACMGenericCodec::in_audio_ix_read_
// in_audio_ix_write: same as ACMGenericCodec::in_audio_ix_write_
// in_timestamp: same as ACMGenericCodec::in_timestamp_
// in_timestamp_ix_write: same as ACMGenericCodec::in_timestamp_ix_write_
// last_timestamp: same as ACMGenericCodec::last_timestamp_
// last_in_timestamp: same as AudioCodingModuleImpl::last_in_timestamp_
//
struct WebRtcACMAudioBuff {
int16_t in_audio[AUDIO_BUFFER_SIZE_W16];
int16_t in_audio_ix_read;
int16_t in_audio_ix_write;
uint32_t in_timestamp[TIMESTAMP_BUFFER_SIZE_W32];
int16_t in_timestamp_ix_write;
uint32_t last_timestamp;
uint32_t last_in_timestamp;
};
} // namespace acm1
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_COMMON_DEFS_H_

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -12,7 +12,7 @@
#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_g7221.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_g7221c.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_g729.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_g7291.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -16,7 +16,7 @@
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/system_wrappers/interface/trace.h"

View File

@ -12,7 +12,7 @@
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_SOURCE_ACM_GENERIC_CODEC_H_
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_gsmfr.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -9,7 +9,7 @@
*/
#include "webrtc/modules/audio_coding/main/source/acm_ilbc.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_isac.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_opus.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_pcm16b.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_pcma.h"
#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_pcmu.h"
#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_red.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -11,7 +11,7 @@
#include "webrtc/modules/audio_coding/main/source/acm_speex.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq.h"
#include "webrtc/modules/audio_coding/neteq/interface/webrtc_neteq_help_macros.h"

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* 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.
*/
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h"
#include "webrtc/modules/audio_coding/main/source/audio_coding_module_impl.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
// Create module
AudioCodingModule* AudioCodingModule::Create(const int32_t id) {
return new acm1::AudioCodingModuleImpl(id, Clock::GetRealTimeClock());
}
// Used for testing by inserting a simulated clock. ACM will not destroy the
// injected |clock| the client has to take care of that.
AudioCodingModule* AudioCodingModule::Create(const int32_t id,
Clock* clock) {
return new acm1::AudioCodingModuleImpl(id, clock);
}
// Destroy module
void AudioCodingModule::Destroy(AudioCodingModule* module) {
delete static_cast<acm1::AudioCodingModuleImpl*>(module);
}
// Get number of supported codecs
uint8_t AudioCodingModule::NumberOfCodecs() {
return static_cast<uint8_t>(acm1::ACMCodecDB::kNumCodecs);
}
// Get supported codec param with id
int32_t AudioCodingModule::Codec(uint8_t list_id,
CodecInst* codec) {
// Get the codec settings for the codec with the given list ID
return acm1::ACMCodecDB::Codec(list_id, codec);
}
// Get supported codec Param with name, frequency and number of channels.
int32_t AudioCodingModule::Codec(const char* payload_name,
CodecInst* codec, int sampling_freq_hz,
int channels) {
int codec_id;
// Get the id of the codec from the database.
codec_id = acm1::ACMCodecDB::CodecId(payload_name, sampling_freq_hz,
channels);
if (codec_id < 0) {
// We couldn't find a matching codec, set the parameters to unacceptable
// values and return.
codec->plname[0] = '\0';
codec->pltype = -1;
codec->pacsize = 0;
codec->rate = 0;
codec->plfreq = 0;
return -1;
}
// Get default codec settings.
acm1::ACMCodecDB::Codec(codec_id, codec);
// Keep the number of channels from the function call. For most codecs it
// will be the same value as in default codec settings, but not for all.
codec->channels = channels;
return 0;
}
// Get supported codec Index with name, frequency and number of channels.
int32_t AudioCodingModule::Codec(const char* payload_name,
int sampling_freq_hz, int channels) {
return acm1::ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels);
}
// Checks the validity of the parameters of the given codec
bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
int mirror_id;
int codec_number = acm1::ACMCodecDB::CodecNumber(&codec, &mirror_id);
if (codec_number < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
"Invalid codec settings.");
return false;
} else {
return true;
}
}
AudioCodingModule* AudioCodingModuleFactory::Create(int id) const {
return new acm1::AudioCodingModuleImpl(static_cast<int32_t>(id),
Clock::GetRealTimeClock());
}
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
// TODO(minyue): return new AudioCodingModuleImpl (new version).
return NULL;
}
} // namespace webrtc

View File

@ -37,7 +37,6 @@
],
'dependencies': [
'<@(audio_coding_dependencies)',
'acm2',
],
'include_dirs': [
'../interface',
@ -101,6 +100,7 @@
'acm_red.h',
'acm_resampler.cc',
'acm_resampler.h',
'audio_coding_module.cc',
'audio_coding_module_impl.cc',
'audio_coding_module_impl.h',
'nack.cc',
@ -146,7 +146,4 @@
],
}],
],
'includes': [
'../acm2/audio_coding_module.gypi',
],
}

View File

@ -17,7 +17,7 @@
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/source/acm_dtmf_detection.h"
#include "webrtc/modules/audio_coding/main/source/acm_generic_codec.h"
#include "webrtc/modules/audio_coding/main/source/acm_resampler.h"
@ -1262,6 +1262,64 @@ int32_t AudioCodingModuleImpl::RegisterTransportCallback(
return 0;
}
// Used by the module to deliver messages to the codec module/application
// AVT(DTMF).
int32_t AudioCodingModuleImpl::RegisterIncomingMessagesCallback(
#ifndef WEBRTC_DTMF_DETECTION
AudioCodingFeedback* /* incoming_message */,
const ACMCountries /* cpt */) {
return -1;
#else
AudioCodingFeedback* incoming_message,
const ACMCountries cpt) {
int16_t status = 0;
// Enter the critical section for callback.
{
CriticalSectionScoped lock(callback_crit_sect_);
dtmf_callback_ = incoming_message;
}
// Enter the ACM critical section to set up the DTMF class.
{
CriticalSectionScoped lock(acm_crit_sect_);
// Check if the call is to disable or enable the callback.
if (incoming_message == NULL) {
// Callback is disabled, delete DTMF-detector class.
if (dtmf_detector_ != NULL) {
delete dtmf_detector_;
dtmf_detector_ = NULL;
}
status = 0;
} else {
status = 0;
if (dtmf_detector_ == NULL) {
dtmf_detector_ = new ACMDTMFDetection;
if (dtmf_detector_ == NULL) {
status = -1;
}
}
if (status >= 0) {
status = dtmf_detector_->Enable(cpt);
if (status < 0) {
// Failed to initialize if DTMF-detection was not enabled before,
// delete the class, and set the callback to NULL and return -1.
delete dtmf_detector_;
dtmf_detector_ = NULL;
}
}
}
}
// Check if we failed in setting up the DTMF-detector class.
if ((status < 0)) {
// We failed, we cannot have the callback.
CriticalSectionScoped lock(callback_crit_sect_);
dtmf_callback_ = NULL;
}
return status;
#endif
}
// Add 10MS of raw (PCM) audio data to the encoder.
int32_t AudioCodingModuleImpl::Add10MsData(
const AudioFrame& audio_frame) {
@ -2404,12 +2462,27 @@ int32_t AudioCodingModuleImpl::PlayoutData10Ms(
return 0;
}
/////////////////////////////////////////
// (CNG) Comfort Noise Generation
// Generate comfort noise when receiving DTX packets
//
// Get VAD aggressiveness on the incoming stream
ACMVADMode AudioCodingModuleImpl::ReceiveVADMode() const {
return neteq_.vad_mode();
}
// Configure VAD aggressiveness on the incoming stream.
int16_t AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
return neteq_.SetVADMode(mode);
}
/////////////////////////////////////////
// Statistics
//
int32_t AudioCodingModuleImpl::NetworkStatistics(
ACMNetworkStatistics* statistics) {
ACMNetworkStatistics* statistics) const {
int32_t status;
status = neteq_.NetworkStatistics(statistics);
return status;
@ -2649,7 +2722,8 @@ int32_t AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
return 0;
}
int AudioCodingModuleImpl::SetISACMaxRate(int max_bit_per_sec) {
int32_t AudioCodingModuleImpl::SetISACMaxRate(
const uint32_t max_bit_per_sec) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxRate")) {
@ -2659,7 +2733,8 @@ int AudioCodingModuleImpl::SetISACMaxRate(int max_bit_per_sec) {
return codecs_[current_send_codec_idx_]->SetISACMaxRate(max_bit_per_sec);
}
int AudioCodingModuleImpl::SetISACMaxPayloadSize(int max_size_bytes) {
int32_t AudioCodingModuleImpl::SetISACMaxPayloadSize(
const uint16_t max_size_bytes) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxPayloadSize")) {
@ -2671,9 +2746,9 @@ int AudioCodingModuleImpl::SetISACMaxPayloadSize(int max_size_bytes) {
}
int32_t AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
int frame_size_ms,
int rate_bit_per_sec,
bool enforce_frame_size) {
const uint8_t frame_size_ms,
const uint16_t rate_bit_per_sec,
const bool enforce_frame_size) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("ConfigISACBandwidthEstimator")) {
@ -2684,6 +2759,21 @@ int32_t AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
frame_size_ms, rate_bit_per_sec, enforce_frame_size);
}
int32_t AudioCodingModuleImpl::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode) {
if ((mode < On) || (mode > Off)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"The specified background noise is out of range.\n");
return -1;
}
return neteq_.SetBackgroundNoiseMode(mode);
}
int32_t AudioCodingModuleImpl::BackgroundNoiseMode(
ACMBackgroundNoiseMode* mode) {
return neteq_.BackgroundNoiseMode(*mode);
}
int32_t AudioCodingModuleImpl::PlayoutTimestamp(
uint32_t* timestamp) {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
@ -2719,7 +2809,8 @@ bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
return true;
}
int AudioCodingModuleImpl::UnregisterReceiveCodec(uint8_t payload_type) {
int32_t AudioCodingModuleImpl::UnregisterReceiveCodec(
const int16_t payload_type) {
CriticalSectionScoped lock(acm_crit_sect_);
int id;

View File

@ -23,14 +23,14 @@
namespace webrtc {
struct WebRtcACMAudioBuff;
struct WebRtcACMCodecParams;
class CriticalSectionWrapper;
class RWLockWrapper;
class Clock;
namespace acm1 {
struct WebRtcACMAudioBuff;
struct WebRtcACMCodecParams;
class ACMDTMFDetection;
class ACMGenericCodec;
class Nack;
@ -96,9 +96,20 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// called to deliver the encoded buffers.
int32_t RegisterTransportCallback(AudioPacketizationCallback* transport);
// Used by the module to deliver messages to the codec module/application
// AVT(DTMF).
int32_t RegisterIncomingMessagesCallback(
AudioCodingFeedback* incoming_message, const ACMCountries cpt);
// Add 10 ms of raw (PCM) audio data to the encoder.
int32_t Add10MsData(const AudioFrame& audio_frame);
// Set background noise mode for NetEQ, on, off or fade.
int32_t SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
// Get current background noise mode.
int32_t BackgroundNoiseMode(ACMBackgroundNoiseMode* mode);
/////////////////////////////////////////
// (FEC) Forward Error Correction
//
@ -123,6 +134,12 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int32_t RegisterVADCallback(ACMVADCallback* vad_callback);
// Get VAD aggressiveness on the incoming stream.
ACMVADMode ReceiveVADMode() const;
// Configure VAD aggressiveness on the incoming stream.
int16_t SetReceiveVADMode(const ACMVADMode mode);
/////////////////////////////////////////
// Receiver
//
@ -203,7 +220,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// Statistics
//
int32_t NetworkStatistics(ACMNetworkStatistics* statistics);
int32_t NetworkStatistics(ACMNetworkStatistics* statistics) const;
void DestructEncoderInst(void* inst);
@ -226,16 +243,16 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int32_t IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx);
int SetISACMaxRate(int max_bit_per_sec);
int32_t SetISACMaxRate(const uint32_t max_bit_per_sec);
int SetISACMaxPayloadSize(int max_size_bytes);
int32_t SetISACMaxPayloadSize(const uint16_t max_size_bytes);
int32_t ConfigISACBandwidthEstimator(
int frame_size_ms,
int rate_bit_per_sec,
bool enforce_frame_size = false);
const uint8_t frame_size_ms,
const uint16_t rate_bit_per_sec,
const bool enforce_frame_size = false);
int UnregisterReceiveCodec(uint8_t payload_type);
int32_t UnregisterReceiveCodec(const int16_t payload_type);
std::vector<uint16_t> GetNackList(int round_trip_time_ms) const;