Wrap ACM2 code inside acm2 namespace. This gurantees that one ACM would not use components of others by accident.

BUG=
R=minyue@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4933 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
turaj@webrtc.org 2013-10-06 04:47:28 +00:00
parent f31639612d
commit 6d5d248075
61 changed files with 251 additions and 15 deletions

View File

@ -43,6 +43,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_AMR
ACMAMR::ACMAMR(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
@ -307,4 +309,6 @@ ACMAMRPackingFormat ACMAMR::AMRDecoderPackingFormat() const {
}
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -21,6 +21,8 @@ namespace webrtc {
enum ACMAMRPackingFormat;
namespace acm2 {
class ACMAMR : public ACMGenericCodec {
public:
explicit ACMAMR(int16_t codec_id);
@ -60,6 +62,8 @@ class ACMAMR : public ACMGenericCodec {
ACMAMRPackingFormat encoder_packing_format_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_AMR_H_

View File

@ -40,6 +40,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_AMRWB
ACMAMRwb::ACMAMRwb(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
@ -313,4 +315,6 @@ ACMAMRPackingFormat ACMAMRwb::AMRwbDecoderPackingFormat() const {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct AMRWB_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMAMRwb : public ACMGenericCodec {
public:
explicit ACMAMRwb(int16_t codec_id);
@ -61,6 +63,8 @@ class ACMAMRwb : public ACMGenericCodec {
ACMAMRPackingFormat encoder_packing_format_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_AMRWB_H_

View File

@ -20,6 +20,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_CELT
ACMCELT::ACMCELT(int16_t /* codec_id */)
@ -188,4 +190,6 @@ int16_t ACMCELT::SetBitRateSafe(const int32_t rate) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct CELT_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMCELT : public ACMGenericCodec {
public:
explicit ACMCELT(int16_t codec_id);
@ -45,6 +47,8 @@ class ACMCELT : public ACMGenericCodec {
uint16_t channels_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_CELT_H_

View File

@ -17,6 +17,8 @@
namespace webrtc {
namespace acm2 {
ACMCNG::ACMCNG(int16_t codec_id) {
encoder_inst_ptr_ = NULL;
codec_id_ = codec_id;
@ -76,4 +78,6 @@ void ACMCNG::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct WebRtcCngDecInst;
namespace webrtc {
namespace acm2 {
class ACMCNG: public ACMGenericCodec {
public:
explicit ACMCNG(int16_t codec_id);
@ -51,6 +53,8 @@ class ACMCNG: public ACMGenericCodec {
uint16_t samp_freq_hz_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_CNG_H_

View File

@ -102,6 +102,8 @@
namespace webrtc {
namespace acm2 {
// Not yet used payload-types.
// 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
// 67, 66, 65
@ -954,4 +956,6 @@ bool ACMCodecDB::OwnsDecoder(int codec_id) {
return ACMCodecDB::codec_settings_[codec_id].owns_decoder;
}
} // namespace acm2
} // namespace webrtc

View File

@ -22,6 +22,8 @@
namespace webrtc {
namespace acm2 {
// TODO(tlegrand): replace class ACMCodecDB with a namespace.
class ACMCodecDB {
public:
@ -350,6 +352,8 @@ class ACMCodecDB {
static const NetEqDecoder neteq_decoders_[kMaxNumCodecs];
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_CODEC_DATABASE_H_

View File

@ -18,6 +18,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_AVT
ACMDTMFPlayout::ACMDTMFPlayout(int16_t /* codec_id */) { return; }
@ -83,4 +85,6 @@ void ACMDTMFPlayout::DestructEncoderSafe() {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
class ACMDTMFPlayout : public ACMGenericCodec {
public:
explicit ACMDTMFPlayout(int16_t codec_id);
@ -35,6 +37,8 @@ class ACMDTMFPlayout : public ACMGenericCodec {
void InternalDestructEncoderInst(void* ptr_inst);
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_DTMF_PLAYOUT_H_

View File

@ -19,6 +19,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_G722
ACMG722::ACMG722(int16_t /* codec_id */)
@ -194,4 +196,6 @@ void ACMG722::InternalDestructEncoderInst(void* ptr_inst) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -18,6 +18,8 @@ typedef struct WebRtcG722DecInst G722DecInst;
namespace webrtc {
namespace acm2 {
// Forward declaration.
struct ACMG722EncStr;
struct ACMG722DecStr;
@ -52,6 +54,8 @@ class ACMG722 : public ACMGenericCodec {
G722EncInst* encoder_inst_ptr_right_; // Prepared for stereo
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_

View File

@ -80,6 +80,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_G722_1
ACMG722_1::ACMG722_1(int16_t /* codec_id */)
@ -323,4 +325,6 @@ void ACMG722_1::InternalDestructEncoderInst(void* ptr_inst) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -24,6 +24,8 @@ struct G722_1_Inst_t_;
namespace webrtc {
namespace acm2 {
class ACMG722_1 : public ACMGenericCodec {
public:
explicit ACMG722_1(int16_t codec_id);
@ -57,6 +59,8 @@ class ACMG722_1 : public ACMGenericCodec {
G722_1_32_encinst_t_* encoder_inst32_ptr_right_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G7221_H_

View File

@ -80,6 +80,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_G722_1C
ACMG722_1C::ACMG722_1C(int16_t /* codec_id */)
@ -329,4 +331,6 @@ void ACMG722_1C::InternalDestructEncoderInst(void* ptr_inst) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -24,6 +24,8 @@ struct G722_1_Inst_t_;
namespace webrtc {
namespace acm2 {
class ACMG722_1C : public ACMGenericCodec {
public:
explicit ACMG722_1C(int16_t codec_id);
@ -57,6 +59,8 @@ class ACMG722_1C : public ACMGenericCodec {
G722_1C_48_encinst_t_* encoder_inst48_ptr_right_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G7221C_H_

View File

@ -22,6 +22,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_G729
ACMG729::ACMG729(int16_t /* codec_id */) : encoder_inst_ptr_(NULL) {}
@ -252,4 +254,6 @@ void ACMG729::InternalDestructEncoderInst(void* ptr_inst) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct G729_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMG729 : public ACMGenericCodec {
public:
explicit ACMG729(int16_t codec_id);
@ -49,6 +51,8 @@ class ACMG729 : public ACMGenericCodec {
G729_encinst_t_* encoder_inst_ptr_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G729_H_

View File

@ -21,6 +21,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_G729_1
ACMG729_1::ACMG729_1(int16_t /* codec_id */)
@ -237,4 +239,6 @@ int16_t ACMG729_1::SetBitRateSafe(const int32_t rate) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct G729_1_inst_t_;
namespace webrtc {
namespace acm2 {
class ACMG729_1 : public ACMGenericCodec {
public:
explicit ACMG729_1(int16_t codec_id);
@ -47,6 +49,8 @@ class ACMG729_1 : public ACMGenericCodec {
int16_t flag_g729_mode_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G7291_H_

View File

@ -21,6 +21,8 @@
namespace webrtc {
namespace acm2 {
// Enum for CNG
enum {
kMaxPLCParamsCNG = WEBRTC_CNG_MAX_LPC_ORDER,
@ -1002,4 +1004,6 @@ int16_t ACMGenericCodec::REDPayloadISAC(const int32_t /* isac_rate */,
return -1;
}
} // namespace acm2
} // namespace webrtc

View File

@ -26,8 +26,12 @@ struct WebRtcCngEncInst;
namespace webrtc {
// forward declaration
struct WebRtcACMCodecParams;
struct CodecInst;
namespace acm2 {
// forward declaration
class AcmReceiver;
class ACMGenericCodec {
@ -909,6 +913,8 @@ class ACMGenericCodec {
uint32_t unique_id_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_GENERIC_CODEC_H_

View File

@ -21,6 +21,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_GSMFR
ACMGSMFR::ACMGSMFR(int16_t /* codec_id */) : encoder_inst_ptr_(NULL) {}
@ -154,4 +156,6 @@ void ACMGSMFR::InternalDestructEncoderInst(void* ptr_inst) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct GSMFR_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMGSMFR : public ACMGenericCodec {
public:
explicit ACMGSMFR(int16_t codec_id);
@ -45,6 +47,8 @@ class ACMGSMFR : public ACMGenericCodec {
GSMFR_encinst_t_* encoder_inst_ptr_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_GSMFR_H_

View File

@ -17,6 +17,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_ILBC
ACMILBC::ACMILBC(int16_t /* codec_id */) : encoder_inst_ptr_(NULL) {}
@ -138,4 +140,6 @@ int16_t ACMILBC::SetBitRateSafe(const int32_t rate) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct iLBC_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMILBC : public ACMGenericCodec {
public:
explicit ACMILBC(int16_t codec_id);
@ -43,6 +45,8 @@ class ACMILBC : public ACMGenericCodec {
iLBC_encinst_t_* encoder_inst_ptr_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_ILBC_H_

View File

@ -31,6 +31,8 @@
namespace webrtc {
namespace acm2 {
// we need this otherwise we cannot use forward declaration
// in the header file
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
@ -826,4 +828,6 @@ AudioDecoder* ACMISAC::Decoder(int codec_id) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
struct ACMISACInst;
class AcmAudioDecoderIsac;
@ -93,6 +95,8 @@ class ACMISAC : public ACMGenericCodec {
bool decoder_initialized_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_ISAC_H_

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
#ifdef WEBRTC_CODEC_ISAC
#define ACM_ISAC_CREATE WebRtcIsac_Create
#define ACM_ISAC_FREE WebRtcIsac_Free
@ -70,6 +72,8 @@ namespace webrtc {
// decoder
#endif
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_ISAC_MACROS_H_

View File

@ -10,4 +10,6 @@
// This file contains unit tests for ACM's NetEQ wrapper (class ACMNetEQ).
namespace webrtc {} // namespace
namespace webrtc {
namespace acm2 {} // namespace

View File

@ -19,6 +19,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_OPUS
ACMOpus::ACMOpus(int16_t /* codec_id */)
@ -184,4 +186,6 @@ int16_t ACMOpus::SetBitRateSafe(const int32_t rate) {
#endif // WEBRTC_CODEC_OPUS
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct WebRtcOpusDecInst;
namespace webrtc {
namespace acm2 {
class ACMOpus : public ACMGenericCodec {
public:
explicit ACMOpus(int16_t codec_id);
@ -45,6 +47,8 @@ class ACMOpus : public ACMGenericCodec {
int channels_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_OPUS_H_

View File

@ -19,6 +19,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_PCM16
ACMPCM16B::ACMPCM16B(int16_t /* codec_id */) { return; }
@ -89,4 +91,6 @@ void ACMPCM16B::DestructEncoderSafe() {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
class ACMPCM16B : public ACMGenericCodec {
public:
explicit ACMPCM16B(int16_t codec_id);
@ -37,6 +39,8 @@ class ACMPCM16B : public ACMGenericCodec {
int32_t sampling_freq_hz_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_PCM16B_H_

View File

@ -18,6 +18,8 @@
namespace webrtc {
namespace acm2 {
ACMPCMA::ACMPCMA(int16_t codec_id) { codec_id_ = codec_id; }
ACMPCMA::~ACMPCMA() { return; }
@ -55,4 +57,6 @@ void ACMPCMA::DestructEncoderSafe() {
return;
}
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
class ACMPCMA : public ACMGenericCodec {
public:
explicit ACMPCMA(int16_t codec_id);
@ -35,6 +37,8 @@ class ACMPCMA : public ACMGenericCodec {
void InternalDestructEncoderInst(void* ptr_inst);
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_PCMA_H_

View File

@ -18,6 +18,8 @@
namespace webrtc {
namespace acm2 {
ACMPCMU::ACMPCMU(int16_t codec_id) { codec_id_ = codec_id; }
ACMPCMU::~ACMPCMU() {}
@ -56,4 +58,6 @@ void ACMPCMU::DestructEncoderSafe() {
encoder_initialized_ = false;
}
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
class ACMPCMU : public ACMGenericCodec {
public:
explicit ACMPCMU(int16_t codec_id);
@ -35,6 +37,8 @@ class ACMPCMU : public ACMGenericCodec {
void InternalDestructEncoderInst(void* ptr_inst);
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_PCMU_H_

View File

@ -30,6 +30,8 @@
namespace webrtc {
namespace acm2 {
namespace {
const int kNeteqInitSampleRateHz = 16000;
@ -829,4 +831,6 @@ void AcmReceiver::InsertStreamOfSyncPackets(
}
}
} // namespace acm2
} // namespace webrtc

View File

@ -26,11 +26,14 @@
namespace webrtc {
struct CodecInst;
class CriticalSectionWrapper;
class RWLockWrapper;
class NetEq;
namespace acm2 {
class Nack;
struct CodecInst;
class AcmReceiver {
public:
@ -360,6 +363,8 @@ class AcmReceiver {
scoped_ptr<InitialDelayManager::SyncStream> late_packets_sync_stream_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_

View File

@ -23,6 +23,8 @@
#include "webrtc/test/testsupport/gtest_disable.h"
namespace webrtc {
namespace acm2 {
namespace {
bool CodecsEqual(const CodecInst& codec_a, const CodecInst& codec_b) {
@ -418,4 +420,6 @@ TEST_F(AcmReceiverTest, DISABLED_ON_ANDROID(LastAudioCodec)) {
}
}
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
ACMRED::ACMRED(int16_t codec_id) { codec_id_ = codec_id; }
ACMRED::~ACMRED() {}
@ -47,4 +49,6 @@ void ACMRED::DestructEncoderSafe() {
// RED has no instance
}
} // namespace acm2
} // namespace webrtc

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
class ACMRED : public ACMGenericCodec {
public:
explicit ACMRED(int16_t codec_id);
@ -35,6 +37,8 @@ class ACMRED : public ACMGenericCodec {
void InternalDestructEncoderInst(void* ptr_inst);
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RED_H_

View File

@ -19,6 +19,8 @@
namespace webrtc {
namespace acm2 {
ACMResampler::ACMResampler()
: resampler_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()) {
}
@ -63,4 +65,6 @@ int ACMResampler::Resample10Msec(const int16_t* in_audio,
return out_len / num_audio_channels;
}
} // namespace acm2
} // namespace webrtc

View File

@ -18,6 +18,8 @@ namespace webrtc {
class CriticalSectionWrapper;
namespace acm2 {
class ACMResampler {
public:
ACMResampler();
@ -35,6 +37,8 @@ class ACMResampler {
CriticalSectionWrapper* resampler_crit_sect_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RESAMPLER_H_

View File

@ -21,6 +21,8 @@
namespace webrtc {
namespace acm2 {
#ifndef WEBRTC_CODEC_SPEEX
ACMSPEEX::ACMSPEEX(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
@ -326,4 +328,6 @@ int16_t ACMSPEEX::SetComplMode(int16_t mode) {
#endif
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@ struct SPEEX_decinst_t_;
namespace webrtc {
namespace acm2 {
class ACMSPEEX : public ACMGenericCodec {
public:
explicit ACMSPEEX(int16_t codec_id);
@ -60,6 +62,8 @@ class ACMSPEEX : public ACMGenericCodec {
uint16_t samples_in_20ms_audio_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_SPEEX_H_

View File

@ -30,13 +30,13 @@ AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
// Get number of supported codecs
int AudioCodingModule::NumberOfCodecs() {
return ACMCodecDB::kNumCodecs;
return acm2::ACMCodecDB::kNumCodecs;
}
// Get supported codec parameters with id
int AudioCodingModule::Codec(int list_id, CodecInst* codec) {
// Get the codec settings for the codec with the given list ID
return ACMCodecDB::Codec(list_id, codec);
return acm2::ACMCodecDB::Codec(list_id, codec);
}
// Get supported codec parameters with name, frequency and number of channels.
@ -47,7 +47,8 @@ int AudioCodingModule::Codec(const char* payload_name,
int codec_id;
// Get the id of the codec from the database.
codec_id = ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels);
codec_id = acm2::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.
@ -60,7 +61,7 @@ int AudioCodingModule::Codec(const char* payload_name,
}
// Get default codec settings.
ACMCodecDB::Codec(codec_id, codec);
acm2::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.
@ -73,14 +74,14 @@ int AudioCodingModule::Codec(const char* payload_name,
int AudioCodingModule::Codec(const char* payload_name,
int sampling_freq_hz,
int channels) {
return ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels);
return acm2::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 = ACMCodecDB::CodecNumber(codec, &mirror_id);
int codec_number = acm2::ACMCodecDB::CodecNumber(codec, &mirror_id);
if (codec_number < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
@ -97,7 +98,7 @@ AudioCodingModule* AudioCodingModuleFactory::Create(int id) const {
}
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
return new AudioCodingModuleImpl(id);
return new acm2::AudioCodingModuleImpl(id);
}
} // namespace webrtc

View File

@ -27,6 +27,8 @@
namespace webrtc {
namespace acm2 {
enum {
kACMToneEnd = 999
};
@ -1974,4 +1976,6 @@ int AudioCodingModuleImpl::LeastRequiredDelayMs() const {
return receiver_.LeastRequiredDelayMs();
}
} // namespace acm2
} // namespace webrtc

View File

@ -22,11 +22,14 @@
namespace webrtc {
class ACMDTMFDetection;
class ACMGenericCodec;
class CriticalSectionWrapper;
class RWLockWrapper;
namespace acm2 {
class ACMDTMFDetection;
class ACMGenericCodec;
class AudioCodingModuleImpl : public AudioCodingModule {
public:
// Constructor
@ -349,6 +352,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
bool first_10ms_data_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_AUDIO_CODING_MODULE_IMPL_H_

View File

@ -12,6 +12,8 @@
namespace webrtc {
namespace acm2 {
InitialDelayManager::InitialDelayManager(int initial_delay_ms,
int late_packet_threshold)
: last_packet_type_(kUndefinedPacket),
@ -227,4 +229,6 @@ void InitialDelayManager::UpdatePlayoutTimestamp(
initial_delay_ms_ * sample_rate_hz / 1000);
}
} // namespace acm2
} // namespace webrtc

View File

@ -16,6 +16,8 @@
namespace webrtc {
namespace acm2 {
class InitialDelayManager {
public:
enum PacketType {
@ -110,6 +112,8 @@ class InitialDelayManager {
const int late_packet_threshold_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_INITIAL_DELAY_MANAGER_H_

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace acm2 {
namespace {
const uint8_t kAudioPayloadType = 0;
@ -368,4 +370,6 @@ TEST_F(InitialDelayManagerTest, BufferingAudio) {
EXPECT_FALSE(manager_->buffering());
}
} // namespace acm2
} // namespace webrtc

View File

@ -19,6 +19,8 @@
namespace webrtc {
namespace acm2 {
namespace {
const int kDefaultSampleRateKhz = 48;
@ -222,4 +224,6 @@ std::vector<uint16_t> Nack::GetNackList(int round_trip_time_ms) const {
return sequence_numbers;
}
} // namespace acm2
} // namespace webrtc

View File

@ -49,6 +49,8 @@
//
namespace webrtc {
namespace acm2 {
class Nack {
public:
// A limit for the size of the NACK list.
@ -204,6 +206,8 @@ class Nack {
size_t max_nack_list_size_;
};
} // namespace acm2
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_NACK_H_

View File

@ -21,6 +21,8 @@
namespace webrtc {
namespace acm2 {
namespace {
const int kNackThreshold = 3;
@ -479,4 +481,6 @@ TEST(NackTest, RoudTripTimeIsApplied) {
EXPECT_EQ(5, nack_list[1]);
}
} // namespace acm2
} // namespace webrtc

View File

@ -27,6 +27,7 @@ namespace webrtc {
// forward declaration
struct CodecInst;
struct WebRtcACMCodecParams;
namespace acm1 {

View File

@ -3002,12 +3002,13 @@ int AudioCodingModuleImpl::LeastRequiredDelayMs() const {
int AudioCodingModuleImpl::EnableNack(size_t max_nack_list_size) {
// Don't do anything if |max_nack_list_size| is out of range.
if (max_nack_list_size == 0 || max_nack_list_size > Nack::kNackListSizeLimit)
if (max_nack_list_size == 0 ||
max_nack_list_size > acm2::Nack::kNackListSizeLimit)
return -1;
CriticalSectionScoped lock(acm_crit_sect_);
if (!nack_enabled_) {
nack_.reset(Nack::Create(kNackThresholdPackets));
nack_.reset(acm2::Nack::Create(kNackThresholdPackets));
nack_enabled_ = true;
// Sampling rate might need to be updated if we change from disable to

View File

@ -28,7 +28,10 @@ struct WebRtcACMCodecParams;
class CriticalSectionWrapper;
class RWLockWrapper;
class Clock;
namespace acm2 {
class Nack;
}
namespace acm1 {
@ -437,7 +440,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int64_t last_receive_timestamp_;
Clock* clock_;
scoped_ptr<Nack> nack_;
scoped_ptr<acm2::Nack> nack_;
bool nack_enabled_;
};