Compile ACM1 and ACM2.
-Make ACM1 to depend on ACM2. -Remove APIs to set and get background noise mode. There is no VoE call to these APIs. -Remove APIs to set and get receive side VAD mode. There is no VoE call to these APIs, and NetEq 4, doesn't support them. -Remove callback for in-band DTMF detection. ACM doesn't support in-band DTMF detection. -Use acm_common_defs.h everywhere required. -Complete ACM factory method. -Update ACMCodecDatabase of ACM2. CNG full-band need to be define-guarded. Remove dynamic payload-type assignment. BUG= R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2237004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4772 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c8dea6a00f
commit
367baa6eb3
@ -102,26 +102,9 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// We dynamically allocate some of the dynamic payload types to the defined
|
||||
// codecs. Note! There are a limited number of payload types. If more codecs
|
||||
// are defined they will receive reserved fixed payload types (values 69-95).
|
||||
const int kDynamicPayloadtypes[ACMCodecDB::kMaxNumCodecs] = {
|
||||
107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 92,
|
||||
91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
|
||||
79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
|
||||
67, 66, 65
|
||||
};
|
||||
|
||||
// Creates database with all supported codecs at compile time.
|
||||
// Each entry needs the following parameters in the given order:
|
||||
// payload type, name, sampling frequency, packet size in samples,
|
||||
// number of channels, and default rate.
|
||||
#if (defined(WEBRTC_CODEC_AMR) || defined(WEBRTC_CODEC_AMRWB) || \
|
||||
defined(WEBRTC_CODEC_CELT) || defined(WEBRTC_CODEC_G722_1) || \
|
||||
defined(WEBRTC_CODEC_G722_1C) || defined(WEBRTC_CODEC_G729_1) || \
|
||||
defined(WEBRTC_CODEC_PCM16) || defined(WEBRTC_CODEC_SPEEX))
|
||||
static int count_database = 0;
|
||||
#endif
|
||||
// Not yet used payload-types.
|
||||
// 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
|
||||
// 67, 66, 65
|
||||
|
||||
const CodecInst ACMCodecDB::database_[] = {
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
|
||||
@ -133,13 +116,13 @@ const CodecInst ACMCodecDB::database_[] = {
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_PCM16
|
||||
// Mono
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 8000, 80, 1, 128000},
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 16000, 160, 1, 256000},
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 32000, 320, 1, 512000},
|
||||
{107, "L16", 8000, 80, 1, 128000},
|
||||
{108, "L16", 16000, 160, 1, 256000},
|
||||
{109, "L16", 32000, 320, 1, 512000},
|
||||
// Stereo
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 8000, 80, 2, 128000},
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 16000, 160, 2, 256000},
|
||||
{kDynamicPayloadtypes[count_database++], "L16", 32000, 320, 2, 512000},
|
||||
{111, "L16", 8000, 80, 2, 128000},
|
||||
{112, "L16", 16000, 160, 2, 256000},
|
||||
{113, "L16", 32000, 320, 2, 512000},
|
||||
#endif
|
||||
// G.711, PCM mu-law and A-law.
|
||||
// Mono
|
||||
@ -152,16 +135,16 @@ const CodecInst ACMCodecDB::database_[] = {
|
||||
{102, "ILBC", 8000, 240, 1, 13300},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AMR
|
||||
{kDynamicPayloadtypes[count_database++], "AMR", 8000, 160, 1, 12200},
|
||||
{114, "AMR", 8000, 160, 1, 12200},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AMRWB
|
||||
{kDynamicPayloadtypes[count_database++], "AMR-WB", 16000, 320, 1, 20000},
|
||||
{115, "AMR-WB", 16000, 320, 1, 20000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_CELT
|
||||
// Mono
|
||||
{kDynamicPayloadtypes[count_database++], "CELT", 32000, 640, 1, 64000},
|
||||
{116, "CELT", 32000, 640, 1, 64000},
|
||||
// Stereo
|
||||
{kDynamicPayloadtypes[count_database++], "CELT", 32000, 640, 2, 64000},
|
||||
{117, "CELT", 32000, 640, 2, 64000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
// Mono
|
||||
@ -170,20 +153,20 @@ const CodecInst ACMCodecDB::database_[] = {
|
||||
{119, "G722", 16000, 320, 2, 64000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722_1
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 32000},
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 24000},
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 16000, 320, 1, 16000},
|
||||
{92, "G7221", 16000, 320, 1, 32000},
|
||||
{91, "G7221", 16000, 320, 1, 24000},
|
||||
{90, "G7221", 16000, 320, 1, 16000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722_1C
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 48000},
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 32000},
|
||||
{kDynamicPayloadtypes[count_database++], "G7221", 32000, 640, 1, 24000},
|
||||
{89, "G7221", 32000, 640, 1, 48000},
|
||||
{88, "G7221", 32000, 640, 1, 32000},
|
||||
{87, "G7221", 32000, 640, 1, 24000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G729
|
||||
{18, "G729", 8000, 240, 1, 8000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G729_1
|
||||
{kDynamicPayloadtypes[count_database++], "G7291", 16000, 320, 1, 32000},
|
||||
{86, "G7291", 16000, 320, 1, 32000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_GSMFR
|
||||
{3, "GSM", 8000, 160, 1, 13200},
|
||||
@ -194,14 +177,16 @@ const CodecInst ACMCodecDB::database_[] = {
|
||||
{120, "opus", 48000, 960, 2, 64000},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_SPEEX
|
||||
{kDynamicPayloadtypes[count_database++], "speex", 8000, 160, 1, 11000},
|
||||
{kDynamicPayloadtypes[count_database++], "speex", 16000, 320, 1, 22000},
|
||||
{85, "speex", 8000, 160, 1, 11000},
|
||||
{84, "speex", 16000, 320, 1, 22000},
|
||||
#endif
|
||||
// Comfort noise for four different sampling frequencies.
|
||||
{13, "CN", 8000, 240, 1, 0},
|
||||
{98, "CN", 16000, 480, 1, 0},
|
||||
{99, "CN", 32000, 960, 1, 0},
|
||||
#ifdef ENABLE_48000_HZ
|
||||
{100, "CN", 48000, 1440, 1, 0},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AVT
|
||||
{106, "telephone-event", 8000, 240, 1, 0},
|
||||
#endif
|
||||
@ -295,7 +280,9 @@ const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
|
||||
{1, {240}, 240, 1, false},
|
||||
{1, {480}, 480, 1, false},
|
||||
{1, {960}, 960, 1, false},
|
||||
#ifdef ENABLE_48000_HZ
|
||||
{1, {1440}, 1440, 1, false},
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AVT
|
||||
{1, {240}, 240, 1, false},
|
||||
#endif
|
||||
@ -383,8 +370,10 @@ const NetEqDecoder ACMCodecDB::neteq_decoders_[] = {
|
||||
// Comfort noise for three different sampling frequencies.
|
||||
kDecoderCNGnb,
|
||||
kDecoderCNGwb,
|
||||
kDecoderCNGswb32kHz,
|
||||
kDecoderCNGswb48kHz
|
||||
kDecoderCNGswb32kHz
|
||||
#ifdef ENABLE_48000_HZ
|
||||
, kDecoderCNGswb48kHz
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AVT
|
||||
, kDecoderAVT
|
||||
#endif
|
||||
@ -710,10 +699,12 @@ ACMGenericCodec* ACMCodecDB::CreateCodecInstance(const CodecInst& codec_inst) {
|
||||
codec_id = kCNSWB;
|
||||
break;
|
||||
}
|
||||
#ifdef ENABLE_48000_HZ
|
||||
case 48000: {
|
||||
codec_id = kCNFB;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
return NULL;
|
||||
}
|
||||
@ -765,10 +756,12 @@ ACMGenericCodec* ACMCodecDB::CreateCodecInstance(const CodecInst& codec_inst) {
|
||||
codec_id = kCNSWB;
|
||||
break;
|
||||
}
|
||||
#ifdef ENABLE_48000_HZ
|
||||
case 48000: {
|
||||
codec_id = kCNFB;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -103,7 +103,9 @@ class ACMCodecDB {
|
||||
, kCNNB
|
||||
, kCNWB
|
||||
, kCNSWB
|
||||
#ifdef ENABLE_48000_HZ
|
||||
, kCNFB
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_AVT
|
||||
, kAVT
|
||||
#endif
|
||||
@ -187,6 +189,9 @@ class ACMCodecDB {
|
||||
#ifndef WEBRTC_CODEC_RED
|
||||
enum {kRED = -1};
|
||||
#endif
|
||||
#ifndef ENABLE_48000_HZ
|
||||
enum { kCNFB = -1 };
|
||||
#endif
|
||||
|
||||
// kMaxNumCodecs - Maximum number of codecs that can be activated in one
|
||||
// build.
|
||||
|
@ -24,22 +24,13 @@
|
||||
#error iSAC and iSACFX codecs cannot be enabled at the same time
|
||||
#endif
|
||||
|
||||
#ifndef STR_CASE_CMP
|
||||
#ifdef WIN32
|
||||
// OS-dependent case-insensitive string comparison
|
||||
#define STR_CASE_CMP(x, y) ::_stricmp(x, y)
|
||||
#else
|
||||
// OS-dependent case-insensitive string comparison
|
||||
#define STR_CASE_CMP(x, y) ::strcasecmp(x, y)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// 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 @ 32 kHz (super wide-band) is 2560 samples.
|
||||
#define AUDIO_BUFFER_SIZE_W16 2560
|
||||
// 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
|
||||
@ -93,6 +84,17 @@ struct WebRtcACMCodecParams {
|
||||
ACMVADMode vad_mode;
|
||||
};
|
||||
|
||||
// TODO(turajs): Remove when ACM1 is removed.
|
||||
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 webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_
|
||||
|
@ -301,7 +301,7 @@ class AcmAudioDecoderIsac : public AudioDecoder {
|
||||
uint32_t arrival_timestamp) {
|
||||
return ACM_ISAC_DECODE_BWE(static_cast<ACM_ISAC_STRUCT*>(state_),
|
||||
reinterpret_cast<const uint16_t*>(payload),
|
||||
payload_len,
|
||||
static_cast<uint32_t>(payload_len),
|
||||
rtp_sequence_number,
|
||||
rtp_timestamp,
|
||||
arrival_timestamp);
|
||||
@ -311,7 +311,7 @@ class AcmAudioDecoderIsac : public AudioDecoder {
|
||||
size_t encoded_len, int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
int16_t temp_type = 1; // Default is speech.
|
||||
int16_t ret = ACM_ISAC_DECODERCU(static_cast<ISACStruct*>(state_),
|
||||
int16_t ret = ACM_ISAC_DECODERCU(static_cast<ACM_ISAC_STRUCT*>(state_),
|
||||
reinterpret_cast<const uint16_t*>(encoded),
|
||||
static_cast<int16_t>(encoded_len), decoded,
|
||||
&temp_type);
|
||||
|
@ -179,7 +179,7 @@ int AcmReceiver::SetInitialDelay(int delay_ms) {
|
||||
// improve performance. Here, this call has to be placed before the following
|
||||
// block, therefore, we keep it inside critical section. Otherwise, we have to
|
||||
// release |neteq_crit_sect_| and acquire it again, which seems an overkill.
|
||||
if (neteq_->SetMinimumDelay(delay_ms) < 0)
|
||||
if (!neteq_->SetMinimumDelay(delay_ms))
|
||||
return -1;
|
||||
|
||||
const int kLatePacketThreshold = 5;
|
||||
@ -620,7 +620,7 @@ void AcmReceiver::NetworkStatistics(ACMNetworkStatistics* acm_stat) {
|
||||
|
||||
acm_stat->currentBufferSize = neteq_stat.current_buffer_size_ms;
|
||||
acm_stat->preferredBufferSize = neteq_stat.preferred_buffer_size_ms;
|
||||
acm_stat->jitterPeaksFound = neteq_stat.jitter_peaks_found;
|
||||
acm_stat->jitterPeaksFound = neteq_stat.jitter_peaks_found ? true : false;
|
||||
acm_stat->currentPacketLossRate = neteq_stat.packet_loss_rate;
|
||||
acm_stat->currentDiscardRate = neteq_stat.packet_discard_rate;
|
||||
acm_stat->currentExpandRate = neteq_stat.expand_rate;
|
||||
@ -745,7 +745,7 @@ bool AcmReceiver::GetSilence(int desired_sample_rate_hz, AudioFrame* frame) {
|
||||
int max_num_packets;
|
||||
int buffer_size_byte;
|
||||
int max_buffer_size_byte;
|
||||
const float kBufferingThresholdScale = 0.9;
|
||||
const float kBufferingThresholdScale = 0.9f;
|
||||
neteq_->PacketBufferStatistics(&num_packets, &max_num_packets,
|
||||
&buffer_size_byte, &max_buffer_size_byte);
|
||||
if (num_packets > max_num_packets * kBufferingThresholdScale ||
|
||||
|
@ -13,18 +13,24 @@
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.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(int id) {
|
||||
return new AudioCodingModuleImpl(id);
|
||||
return new acm1::AudioCodingModuleImpl(id, Clock::GetRealTimeClock());
|
||||
}
|
||||
|
||||
AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
|
||||
return new acm1::AudioCodingModuleImpl(id, clock);
|
||||
}
|
||||
|
||||
// Destroy module
|
||||
void AudioCodingModule::Destroy(AudioCodingModule* module) {
|
||||
delete static_cast<AudioCodingModuleImpl*>(module);
|
||||
delete module;
|
||||
}
|
||||
|
||||
// Get number of supported codecs
|
||||
@ -90,11 +96,12 @@ bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
|
||||
}
|
||||
}
|
||||
|
||||
AudioCodingModule* AudioCodingModuleFactory::Create(const int32_t id) const {
|
||||
return NULL;
|
||||
AudioCodingModule* AudioCodingModuleFactory::Create(int id) const {
|
||||
return new acm1::AudioCodingModuleImpl(static_cast<int32_t>(id),
|
||||
Clock::GetRealTimeClock());
|
||||
}
|
||||
|
||||
AudioCodingModule* NewAudioCodingModuleFactory::Create(const int32_t id) const {
|
||||
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
|
||||
return new AudioCodingModuleImpl(id);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'<@(audio_coding_dependencies)',
|
||||
'NetEq4',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../interface',
|
||||
@ -40,6 +41,7 @@
|
||||
'acm_cng.h',
|
||||
'acm_codec_database.cc',
|
||||
'acm_codec_database.h',
|
||||
'acm_common_defs.h',
|
||||
'acm_dtmf_playout.cc',
|
||||
'acm_dtmf_playout.h',
|
||||
'acm_g722.cc',
|
||||
|
@ -153,7 +153,6 @@ void InitialDelayManager::RecordLastPacket(const WebRtcRTPHeader& rtp_info,
|
||||
void InitialDelayManager::LatePackets(
|
||||
uint32_t timestamp_now, SyncStream* sync_stream) {
|
||||
assert(sync_stream);
|
||||
const int kLateThreshold = 5;
|
||||
sync_stream->num_sync_packets = 0;
|
||||
|
||||
// If there is no estimate of timestamp increment, |timestamp_step_|, then
|
||||
@ -171,7 +170,7 @@ void InitialDelayManager::LatePackets(
|
||||
int num_late_packets = (timestamp_now - last_receive_timestamp_) /
|
||||
timestamp_step_;
|
||||
|
||||
if (num_late_packets < kLateThreshold)
|
||||
if (num_late_packets < late_packet_threshold_)
|
||||
return;
|
||||
|
||||
int sync_offset = 1; // One gap at the end of the sync-stream.
|
||||
|
@ -85,8 +85,8 @@ class AudioCodingModule: public Module {
|
||||
// injected into ACM. ACM will take the owner ship of the object clock and
|
||||
// delete it when destroyed.
|
||||
//
|
||||
static AudioCodingModule* Create(const int32_t id);
|
||||
static AudioCodingModule* Create(const int32_t id, Clock* clock);
|
||||
static AudioCodingModule* Create(int id);
|
||||
static AudioCodingModule* Create(int id, Clock* clock);
|
||||
virtual ~AudioCodingModule() {};
|
||||
|
||||
// TODO(ajm): Deprecated. Remove all calls to this unneeded method.
|
||||
@ -103,7 +103,7 @@ class AudioCodingModule: public Module {
|
||||
// Return value:
|
||||
// number of supported codecs.
|
||||
///
|
||||
static uint8_t NumberOfCodecs();
|
||||
static int NumberOfCodecs();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t Codec()
|
||||
@ -120,7 +120,7 @@ class AudioCodingModule: public Module {
|
||||
// -1 if the list number (list_id) is invalid.
|
||||
// 0 if succeeded.
|
||||
//
|
||||
static int32_t Codec(uint8_t list_id, CodecInst* codec);
|
||||
static int Codec(int list_id, CodecInst* codec);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t Codec()
|
||||
@ -141,7 +141,7 @@ class AudioCodingModule: public Module {
|
||||
// -1 if no codec matches the given parameters.
|
||||
// 0 if succeeded.
|
||||
//
|
||||
static int32_t Codec(const char* payload_name, CodecInst* codec,
|
||||
static int Codec(const char* payload_name, CodecInst* codec,
|
||||
int sampling_freq_hz, int channels);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -160,7 +160,7 @@ class AudioCodingModule: public Module {
|
||||
// if the codec is found, the index of the codec in the list,
|
||||
// -1 if the codec is not found.
|
||||
//
|
||||
static int32_t Codec(const char* payload_name, int sampling_freq_hz,
|
||||
static int Codec(const char* payload_name, int sampling_freq_hz,
|
||||
int channels);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -582,8 +582,8 @@ class AudioCodingModule: public Module {
|
||||
// -1 if fails to unregister.
|
||||
// 0 if the given codec is successfully unregistered.
|
||||
//
|
||||
virtual int32_t UnregisterReceiveCodec(
|
||||
const int16_t payload_type) = 0;
|
||||
virtual int UnregisterReceiveCodec(
|
||||
uint8_t payload_type) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t ReceiveCodec()
|
||||
@ -682,29 +682,6 @@ class AudioCodingModule: public Module {
|
||||
//
|
||||
virtual int LeastRequiredDelayMs() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t RegisterIncomingMessagesCallback()
|
||||
// Used by the module to deliver messages to the codec module/application
|
||||
// when a DTMF tone is detected, as well as when it stopped.
|
||||
//
|
||||
// Inputs:
|
||||
// -in_message_callback: pointer to callback function which will be called
|
||||
// if DTMF is detected.
|
||||
// -cpt : enables CPT (Call Progress Tone) detection for the
|
||||
// specified country. c.f. definition of ACMCountries
|
||||
// in audio_coding_module_typedefs.h for valid
|
||||
// entries. The default value disables CPT
|
||||
// detection.
|
||||
//
|
||||
// Return value:
|
||||
// -1 if the message callback could not be registered
|
||||
// 0 if registration is successful.
|
||||
//
|
||||
virtual int32_t
|
||||
RegisterIncomingMessagesCallback(
|
||||
AudioCodingFeedback* in_message_callback,
|
||||
const ACMCountries cpt = ACMDisableCountryDetection) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t SetDtmfPlayoutStatus()
|
||||
// Configure DTMF playout, i.e. whether out-of-band
|
||||
@ -730,39 +707,6 @@ class AudioCodingModule: public Module {
|
||||
//
|
||||
virtual bool DtmfPlayoutStatus() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t SetBackgroundNoiseMode()
|
||||
// Sets the mode of the background noise playout in an event of long
|
||||
// packet loss burst. For the valid modes see the declaration of
|
||||
// ACMBackgroundNoiseMode in audio_coding_module_typedefs.h.
|
||||
//
|
||||
// Input:
|
||||
// -mode : the mode for the background noise playout.
|
||||
//
|
||||
// Return value:
|
||||
// -1 if failed to set the mode.
|
||||
// 0 if succeeded in setting the mode.
|
||||
//
|
||||
virtual int32_t SetBackgroundNoiseMode(
|
||||
const ACMBackgroundNoiseMode mode) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t BackgroundNoiseMode()
|
||||
// Call this method to get the mode of the background noise playout.
|
||||
// Playout of background noise is a result of a long packet loss burst.
|
||||
// See ACMBackgroundNoiseMode in audio_coding_module_typedefs.h for
|
||||
// possible modes.
|
||||
//
|
||||
// Output:
|
||||
// -mode : a reference to ACMBackgroundNoiseMode enumerator.
|
||||
//
|
||||
// Return value:
|
||||
// 0 if the output is a valid mode.
|
||||
// -1 if ACM failed to output a valid mode.
|
||||
//
|
||||
// TODO(tlegrand): Change function to return the mode.
|
||||
virtual int32_t BackgroundNoiseMode(ACMBackgroundNoiseMode* mode) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t PlayoutTimestamp()
|
||||
// The send timestamp of an RTP packet is associated with the decoded
|
||||
@ -852,39 +796,6 @@ class AudioCodingModule: public Module {
|
||||
virtual int32_t PlayoutData10Ms(int32_t desired_freq_hz,
|
||||
AudioFrame* audio_frame) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// (CNG) Comfort Noise Generation
|
||||
// Generate comfort noise when receiving DTX packets
|
||||
//
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int16_t SetReceiveVADMode()
|
||||
// Configure VAD aggressiveness on the incoming stream.
|
||||
//
|
||||
// Input:
|
||||
// -mode : aggressiveness of the VAD on incoming stream.
|
||||
// See audio_coding_module_typedefs.h for the
|
||||
// definition of ACMVADMode, and possible
|
||||
// values for aggressiveness.
|
||||
//
|
||||
// Return value:
|
||||
// -1 if fails to set the mode,
|
||||
// 0 if the mode is set successfully.
|
||||
//
|
||||
virtual int16_t SetReceiveVADMode(const ACMVADMode mode) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ACMVADMode ReceiveVADMode()
|
||||
// Get VAD aggressiveness on the incoming stream.
|
||||
//
|
||||
// Return value:
|
||||
// aggressiveness of VAD, running on the incoming stream. A more
|
||||
// aggressive mode means more audio frames will be labeled as in-active.
|
||||
// See audio_coding_module_typedefs.h for the definition of
|
||||
// ACMVADMode.
|
||||
//
|
||||
virtual ACMVADMode ReceiveVADMode() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Codec specific
|
||||
//
|
||||
@ -904,8 +815,7 @@ class AudioCodingModule: public Module {
|
||||
// -1 if failed to set the maximum rate.
|
||||
// 0 if the maximum rate is set successfully.
|
||||
//
|
||||
virtual int32_t SetISACMaxRate(
|
||||
const uint32_t max_rate_bps) = 0;
|
||||
virtual int SetISACMaxRate(int max_rate_bps) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t SetISACMaxPayloadSize()
|
||||
@ -922,8 +832,7 @@ class AudioCodingModule: public Module {
|
||||
// -1 if failed to set the maximum payload-size.
|
||||
// 0 if the given length is set successfully.
|
||||
//
|
||||
virtual int32_t SetISACMaxPayloadSize(
|
||||
const uint16_t max_payload_len_bytes) = 0;
|
||||
virtual int SetISACMaxPayloadSize(int max_payload_len_bytes) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t ConfigISACBandwidthEstimator()
|
||||
@ -950,9 +859,9 @@ class AudioCodingModule: public Module {
|
||||
// 0 if the configuration was successfully applied.
|
||||
//
|
||||
virtual int32_t ConfigISACBandwidthEstimator(
|
||||
const uint8_t init_frame_size_ms,
|
||||
const uint16_t init_rate_bps,
|
||||
const bool enforce_frame_size = false) = 0;
|
||||
int init_frame_size_ms,
|
||||
int init_rate_bps,
|
||||
bool enforce_frame_size = false) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// statistics
|
||||
@ -960,7 +869,8 @@ class AudioCodingModule: public Module {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t NetworkStatistics()
|
||||
// Get network statistics.
|
||||
// Get network statistics. Note that the internal statistics of NetEq are
|
||||
// reset by this call.
|
||||
//
|
||||
// Input:
|
||||
// -network_statistics : a structure that contains network statistics.
|
||||
@ -970,7 +880,7 @@ class AudioCodingModule: public Module {
|
||||
// 0 if statistics are set successfully.
|
||||
//
|
||||
virtual int32_t NetworkStatistics(
|
||||
ACMNetworkStatistics* network_statistics) const = 0;
|
||||
ACMNetworkStatistics* network_statistics) = 0;
|
||||
|
||||
//
|
||||
// Set an initial delay for playout.
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_celt.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -17,7 +17,7 @@
|
||||
// references, where appropriate.
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_codec_database.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
// Includes needed to create the codecs.
|
||||
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* 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_
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_dtmf_playout.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_g729.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_g7291.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_neteq.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_gsmfr.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_ilbc.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_red.h"
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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"
|
||||
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* 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
|
@ -37,6 +37,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'<@(audio_coding_dependencies)',
|
||||
'acm2',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../interface',
|
||||
@ -100,7 +101,6 @@
|
||||
'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,4 +146,7 @@
|
||||
],
|
||||
}],
|
||||
],
|
||||
'includes': [
|
||||
'../acm2/audio_coding_module.gypi',
|
||||
],
|
||||
}
|
||||
|
@ -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/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/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,64 +1262,6 @@ 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) {
|
||||
@ -2462,27 +2404,12 @@ 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) const {
|
||||
ACMNetworkStatistics* statistics) {
|
||||
int32_t status;
|
||||
status = neteq_.NetworkStatistics(statistics);
|
||||
return status;
|
||||
@ -2722,8 +2649,7 @@ int32_t AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioCodingModuleImpl::SetISACMaxRate(
|
||||
const uint32_t max_bit_per_sec) {
|
||||
int AudioCodingModuleImpl::SetISACMaxRate(int max_bit_per_sec) {
|
||||
CriticalSectionScoped lock(acm_crit_sect_);
|
||||
|
||||
if (!HaveValidEncoder("SetISACMaxRate")) {
|
||||
@ -2733,8 +2659,7 @@ int32_t AudioCodingModuleImpl::SetISACMaxRate(
|
||||
return codecs_[current_send_codec_idx_]->SetISACMaxRate(max_bit_per_sec);
|
||||
}
|
||||
|
||||
int32_t AudioCodingModuleImpl::SetISACMaxPayloadSize(
|
||||
const uint16_t max_size_bytes) {
|
||||
int AudioCodingModuleImpl::SetISACMaxPayloadSize(int max_size_bytes) {
|
||||
CriticalSectionScoped lock(acm_crit_sect_);
|
||||
|
||||
if (!HaveValidEncoder("SetISACMaxPayloadSize")) {
|
||||
@ -2746,9 +2671,9 @@ int32_t AudioCodingModuleImpl::SetISACMaxPayloadSize(
|
||||
}
|
||||
|
||||
int32_t AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
|
||||
const uint8_t frame_size_ms,
|
||||
const uint16_t rate_bit_per_sec,
|
||||
const bool enforce_frame_size) {
|
||||
int frame_size_ms,
|
||||
int rate_bit_per_sec,
|
||||
bool enforce_frame_size) {
|
||||
CriticalSectionScoped lock(acm_crit_sect_);
|
||||
|
||||
if (!HaveValidEncoder("ConfigISACBandwidthEstimator")) {
|
||||
@ -2759,21 +2684,6 @@ 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_,
|
||||
@ -2809,8 +2719,7 @@ bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t AudioCodingModuleImpl::UnregisterReceiveCodec(
|
||||
const int16_t payload_type) {
|
||||
int AudioCodingModuleImpl::UnregisterReceiveCodec(uint8_t payload_type) {
|
||||
CriticalSectionScoped lock(acm_crit_sect_);
|
||||
int id;
|
||||
|
||||
|
@ -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,20 +96,9 @@ 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
|
||||
//
|
||||
@ -134,12 +123,6 @@ 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
|
||||
//
|
||||
@ -220,7 +203,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
||||
// Statistics
|
||||
//
|
||||
|
||||
int32_t NetworkStatistics(ACMNetworkStatistics* statistics) const;
|
||||
int32_t NetworkStatistics(ACMNetworkStatistics* statistics);
|
||||
|
||||
void DestructEncoderInst(void* inst);
|
||||
|
||||
@ -243,16 +226,16 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
||||
|
||||
int32_t IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx);
|
||||
|
||||
int32_t SetISACMaxRate(const uint32_t max_bit_per_sec);
|
||||
int SetISACMaxRate(int max_bit_per_sec);
|
||||
|
||||
int32_t SetISACMaxPayloadSize(const uint16_t max_size_bytes);
|
||||
int SetISACMaxPayloadSize(int max_size_bytes);
|
||||
|
||||
int32_t ConfigISACBandwidthEstimator(
|
||||
const uint8_t frame_size_ms,
|
||||
const uint16_t rate_bit_per_sec,
|
||||
const bool enforce_frame_size = false);
|
||||
int frame_size_ms,
|
||||
int rate_bit_per_sec,
|
||||
bool enforce_frame_size = false);
|
||||
|
||||
int32_t UnregisterReceiveCodec(const int16_t payload_type);
|
||||
int UnregisterReceiveCodec(uint8_t payload_type);
|
||||
|
||||
std::vector<uint16_t> GetNackList(int round_trip_time_ms) const;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||
@ -98,11 +98,6 @@ APITest::APITest()
|
||||
_payloadUsed[n] = false;
|
||||
}
|
||||
|
||||
for (n = 0; n < 3; n++) {
|
||||
_receiveVADActivityA[n] = 0;
|
||||
_receiveVADActivityB[n] = 0;
|
||||
}
|
||||
|
||||
_movingDot[40] = '\0';
|
||||
|
||||
for (int n = 0; n < 40; n++) {
|
||||
@ -352,7 +347,6 @@ bool APITest::PullAudioRunA() {
|
||||
if (_writeToFile) {
|
||||
_outFileA.Write10MsData(audioFrame);
|
||||
}
|
||||
_receiveVADActivityA[(int) audioFrame.vad_activity_]++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -374,7 +368,6 @@ bool APITest::PullAudioRunB() {
|
||||
if (_writeToFile) {
|
||||
_outFileB.Write10MsData(audioFrame);
|
||||
}
|
||||
_receiveVADActivityB[(int) audioFrame.vad_activity_]++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -458,7 +451,7 @@ void APITest::RunTest(char thread) {
|
||||
{
|
||||
WriteLockScoped cs(_apiTestRWLock);
|
||||
if (thread == 'A') {
|
||||
_testNumA = (_testNumB + 1 + (rand() % 6)) % 7;
|
||||
_testNumA = (_testNumB + 1 + (rand() % 4)) % 5;
|
||||
testNum = _testNumA;
|
||||
|
||||
_movingDot[_dotPositionA] = ' ';
|
||||
@ -471,7 +464,7 @@ void APITest::RunTest(char thread) {
|
||||
_dotPositionA += _dotMoveDirectionA;
|
||||
_movingDot[_dotPositionA] = (_dotMoveDirectionA > 0) ? '>' : '<';
|
||||
} else {
|
||||
_testNumB = (_testNumA + 1 + (rand() % 6)) % 7;
|
||||
_testNumB = (_testNumA + 1 + (rand() % 4)) % 5;
|
||||
testNum = _testNumB;
|
||||
|
||||
_movingDot[_dotPositionB] = ' ';
|
||||
@ -507,14 +500,6 @@ void APITest::RunTest(char thread) {
|
||||
case 4:
|
||||
TestRegisteration('A');
|
||||
break;
|
||||
case 5:
|
||||
TestReceiverVAD('A');
|
||||
break;
|
||||
case 6:
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
LookForDTMF('A');
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Wrong Test Number\n");
|
||||
getchar();
|
||||
@ -543,10 +528,6 @@ bool APITest::APIRunA() {
|
||||
// VAD TEST
|
||||
TestSendVAD('A');
|
||||
TestRegisteration('A');
|
||||
TestReceiverVAD('A');
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
LookForDTMF('A');
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -981,18 +962,15 @@ void APITest::TestRegisteration(char sendSide) {
|
||||
void APITest::TestPlayout(char receiveSide) {
|
||||
AudioCodingModule* receiveACM;
|
||||
AudioPlayoutMode* playoutMode = NULL;
|
||||
ACMBackgroundNoiseMode* bgnMode = NULL;
|
||||
switch (receiveSide) {
|
||||
case 'A': {
|
||||
receiveACM = _acmA;
|
||||
playoutMode = &_playoutModeA;
|
||||
bgnMode = &_bgnModeA;
|
||||
break;
|
||||
}
|
||||
case 'B': {
|
||||
receiveACM = _acmB;
|
||||
playoutMode = &_playoutModeB;
|
||||
bgnMode = &_bgnModeB;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1005,29 +983,6 @@ void APITest::TestPlayout(char receiveSide) {
|
||||
CHECK_ERROR_MT(receiveFreqHz);
|
||||
CHECK_ERROR_MT(playoutFreqHz);
|
||||
|
||||
char bgnString[25];
|
||||
switch (*bgnMode) {
|
||||
case On: {
|
||||
*bgnMode = Fade;
|
||||
strncpy(bgnString, "Fade", 25);
|
||||
break;
|
||||
}
|
||||
case Fade: {
|
||||
*bgnMode = Off;
|
||||
strncpy(bgnString, "OFF", 25);
|
||||
break;
|
||||
}
|
||||
case Off: {
|
||||
*bgnMode = On;
|
||||
strncpy(bgnString, "ON", 25);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*bgnMode = On;
|
||||
strncpy(bgnString, "ON", 25);
|
||||
}
|
||||
CHECK_ERROR_MT(receiveACM->SetBackgroundNoiseMode(*bgnMode));
|
||||
bgnString[24] = '\0';
|
||||
|
||||
char playoutString[25];
|
||||
switch (*playoutMode) {
|
||||
@ -1060,63 +1015,10 @@ void APITest::TestPlayout(char receiveSide) {
|
||||
fprintf(stdout, "Receive Frequency....... %d Hz\n", receiveFreqHz);
|
||||
fprintf(stdout, "Playout Frequency....... %d Hz\n", playoutFreqHz);
|
||||
fprintf(stdout, "Audio Playout Mode...... %s\n", playoutString);
|
||||
fprintf(stdout, "Background Noise Mode... %s\n", bgnString);
|
||||
}
|
||||
}
|
||||
|
||||
// set/get receiver VAD status & mode.
|
||||
void APITest::TestReceiverVAD(char side) {
|
||||
AudioCodingModule* myACM;
|
||||
int* myReceiveVADActivity;
|
||||
|
||||
if (side == 'A') {
|
||||
myACM = _acmA;
|
||||
myReceiveVADActivity = _receiveVADActivityA;
|
||||
} else {
|
||||
myACM = _acmB;
|
||||
myReceiveVADActivity = _receiveVADActivityB;
|
||||
}
|
||||
|
||||
ACMVADMode mode = myACM->ReceiveVADMode();
|
||||
|
||||
CHECK_ERROR_MT(mode);
|
||||
|
||||
if (!_randomTest) {
|
||||
fprintf(stdout, "\n\nCurrent Receive VAD at side %c\n", side);
|
||||
fprintf(stdout, "----------------------------------\n");
|
||||
fprintf(stdout, "mode.......... %d\n", (int) mode);
|
||||
fprintf(stdout, "VAD Active.... %d\n", myReceiveVADActivity[0]);
|
||||
fprintf(stdout, "VAD Passive... %d\n", myReceiveVADActivity[1]);
|
||||
fprintf(stdout, "VAD Unknown... %d\n", myReceiveVADActivity[2]);
|
||||
}
|
||||
|
||||
if (!_randomTest) {
|
||||
fprintf(stdout, "\nChange Receive VAD at side %c\n\n", side);
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case VADNormal:
|
||||
mode = VADAggr;
|
||||
break;
|
||||
case VADLowBitrate:
|
||||
mode = VADVeryAggr;
|
||||
break;
|
||||
case VADAggr:
|
||||
mode = VADLowBitrate;
|
||||
break;
|
||||
case VADVeryAggr:
|
||||
mode = VADNormal;
|
||||
break;
|
||||
default:
|
||||
mode = VADNormal;
|
||||
|
||||
CHECK_ERROR_MT(myACM->SetReceiveVADMode(mode));
|
||||
}
|
||||
for (int n = 0; n < 3; n++) {
|
||||
myReceiveVADActivity[n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void APITest::TestSendVAD(char side) {
|
||||
if (_randomTest) {
|
||||
return;
|
||||
@ -1317,23 +1219,4 @@ void APITest::ChangeCodec(char side) {
|
||||
Wait(500);
|
||||
}
|
||||
|
||||
void APITest::LookForDTMF(char side) {
|
||||
if (!_randomTest) {
|
||||
fprintf(stdout, "\n\nLooking for DTMF Signal in Side %c\n", side);
|
||||
fprintf(stdout, "----------------------------------------\n");
|
||||
}
|
||||
|
||||
if (side == 'A') {
|
||||
_acmB->RegisterIncomingMessagesCallback(NULL);
|
||||
_acmA->RegisterIncomingMessagesCallback(_dtmfCallback);
|
||||
Wait(1000);
|
||||
_acmA->RegisterIncomingMessagesCallback(NULL);
|
||||
} else {
|
||||
_acmA->RegisterIncomingMessagesCallback(NULL);
|
||||
_acmB->RegisterIncomingMessagesCallback(_dtmfCallback);
|
||||
Wait(1000);
|
||||
_acmB->RegisterIncomingMessagesCallback(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -56,9 +56,6 @@ class APITest : public ACMTest {
|
||||
// Receiver Frequency, playout frequency.
|
||||
void TestPlayout(char receiveSide);
|
||||
|
||||
// set/get receiver VAD status & mode.
|
||||
void TestReceiverVAD(char side);
|
||||
|
||||
//
|
||||
void TestSendVAD(char side);
|
||||
|
||||
@ -68,8 +65,6 @@ class APITest : public ACMTest {
|
||||
|
||||
void Wait(uint32_t waitLengthMs);
|
||||
|
||||
void LookForDTMF(char side);
|
||||
|
||||
void RunTest(char thread);
|
||||
|
||||
bool PushAudioRunA();
|
||||
@ -145,11 +140,6 @@ class APITest : public ACMTest {
|
||||
AudioPlayoutMode _playoutModeA;
|
||||
AudioPlayoutMode _playoutModeB;
|
||||
|
||||
ACMBackgroundNoiseMode _bgnModeA;
|
||||
ACMBackgroundNoiseMode _bgnModeB;
|
||||
|
||||
int _receiveVADActivityA[3];
|
||||
int _receiveVADActivityB[3];
|
||||
bool _verbose;
|
||||
|
||||
int _dotPositionA;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/Channel.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/PCMFile.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "../source/acm_common_defs.h"
|
||||
#include "../acm2/acm_common_defs.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "audio_coding_module.h"
|
||||
#include "PCMFile.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
|
||||
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
|
||||
#define NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE 13
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user