WebRtc_Word32 => int32_t etc. in audio_coding/

BUG=314

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3789 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2013-04-09 00:28:06 +00:00
parent 6faf71d27b
commit 0946a56023
382 changed files with 8469 additions and 8488 deletions

View File

@ -50,7 +50,7 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_AMR
ACMAMR::ACMAMR(WebRtc_Word16 /* codec_id */)
ACMAMR::ACMAMR(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
encoding_mode_(-1), // Invalid value.
@ -64,39 +64,39 @@ ACMAMR::~ACMAMR() {
return;
}
WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMAMR::InternalEncode(uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMAMR::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMAMR::EnableDTX() {
int16_t ACMAMR::EnableDTX() {
return -1;
}
WebRtc_Word16 ACMAMR::DisableDTX() {
int16_t ACMAMR::DisableDTX() {
return -1;
}
WebRtc_Word16 ACMAMR::InternalInitEncoder(
int16_t ACMAMR::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMAMR::InternalInitDecoder(
int16_t ACMAMR::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -104,7 +104,7 @@ ACMGenericCodec* ACMAMR::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMAMR::InternalCreateEncoder() {
int16_t ACMAMR::InternalCreateEncoder() {
return -1;
}
@ -112,7 +112,7 @@ void ACMAMR::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMAMR::InternalCreateDecoder() {
int16_t ACMAMR::InternalCreateDecoder() {
return -1;
}
@ -120,7 +120,7 @@ void ACMAMR::DestructDecoderSafe() {
return;
}
WebRtc_Word16 ACMAMR::SetBitRateSafe(const WebRtc_Word32 /* rate */) {
int16_t ACMAMR::SetBitRateSafe(const int32_t /* rate */) {
return -1;
}
@ -128,7 +128,7 @@ void ACMAMR::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat(
int16_t ACMAMR::SetAMREncoderPackingFormat(
ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@ -137,7 +137,7 @@ ACMAMRPackingFormat ACMAMR::AMREncoderPackingFormat() const {
return AMRUndefined;
}
WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat(
int16_t ACMAMR::SetAMRDecoderPackingFormat(
ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@ -157,7 +157,7 @@ ACMAMRPackingFormat ACMAMR::AMRDecoderPackingFormat() const {
#define WEBRTC_AMR_MR102 6
#define WEBRTC_AMR_MR122 7
ACMAMR::ACMAMR(WebRtc_Word16 codec_id)
ACMAMR::ACMAMR(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
encoding_mode_(-1), // invalid value
@ -181,9 +181,9 @@ ACMAMR::~ACMAMR() {
return;
}
WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 vad_decision = 1;
int16_t ACMAMR::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
int16_t vad_decision = 1;
// sanity check, if the rate is set correctly. we might skip this
// sanity check. if rate is not set correctly, initialization flag
// should be false and should not be here.
@ -195,7 +195,7 @@ WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitstream,
*bitstream_len_byte = WebRtcAmr_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
frame_len_smpl_,
(WebRtc_Word16*)bitstream,
(int16_t*)bitstream,
encoding_mode_);
// Update VAD, if internal DTX is used
@ -203,7 +203,7 @@ WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitstream,
if (*bitstream_len_byte <= (7 * frame_len_smpl_ / 160)) {
vad_decision = 0;
}
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
for (int16_t n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
vad_label_[n] = vad_decision;
}
}
@ -212,15 +212,15 @@ WebRtc_Word16 ACMAMR::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMAMR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMAMR::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMAMR::EnableDTX() {
int16_t ACMAMR::EnableDTX() {
if (dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -235,7 +235,7 @@ WebRtc_Word16 ACMAMR::EnableDTX() {
}
}
WebRtc_Word16 ACMAMR::DisableDTX() {
int16_t ACMAMR::DisableDTX() {
if (!dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -251,8 +251,8 @@ WebRtc_Word16 ACMAMR::DisableDTX() {
}
}
WebRtc_Word16 ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
WebRtc_Word16 status = SetBitRateSafe((codec_params->codec_inst).rate);
int16_t ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t status = SetBitRateSafe((codec_params->codec_inst).rate);
status += (WebRtcAmr_EncoderInit(
encoder_inst_ptr_, ((codec_params->enable_dtx) ? 1 : 0)) < 0) ? -1 : 0;
status += (WebRtcAmr_EncodeBitmode(
@ -260,16 +260,16 @@ WebRtc_Word16 ACMAMR::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
return (status < 0) ? -1 : 0;
}
WebRtc_Word16 ACMAMR::InternalInitDecoder(
int16_t ACMAMR::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
WebRtc_Word16 status =
int16_t status =
((WebRtcAmr_DecoderInit(decoder_inst_ptr_) < 0) ? -1 : 0);
status += WebRtcAmr_DecodeBitmode(decoder_inst_ptr_, decoder_packing_format_);
return (status < 0) ? -1 : 0;
}
WebRtc_Word32 ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMAMR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// Todo:
// log error
@ -289,7 +289,7 @@ ACMGenericCodec* ACMAMR::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMAMR::InternalCreateEncoder() {
int16_t ACMAMR::InternalCreateEncoder() {
return WebRtcAmr_CreateEnc(&encoder_inst_ptr_);
}
@ -305,7 +305,7 @@ void ACMAMR::DestructEncoderSafe() {
encoding_rate_ = 0; // invalid value
}
WebRtc_Word16 ACMAMR::InternalCreateDecoder() {
int16_t ACMAMR::InternalCreateDecoder() {
return WebRtcAmr_CreateDec(&decoder_inst_ptr_);
}
@ -319,7 +319,7 @@ void ACMAMR::DestructDecoderSafe() {
decoder_initialized_ = false;
}
WebRtc_Word16 ACMAMR::SetBitRateSafe(const WebRtc_Word32 rate) {
int16_t ACMAMR::SetBitRateSafe(const int32_t rate) {
switch (rate) {
case 4750: {
encoding_mode_ = WEBRTC_AMR_MR475;
@ -376,7 +376,7 @@ void ACMAMR::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
WebRtc_Word16 ACMAMR::SetAMREncoderPackingFormat(
int16_t ACMAMR::SetAMREncoderPackingFormat(
ACMAMRPackingFormat packing_format) {
if ((packing_format != AMRBandwidthEfficient) &&
(packing_format != AMROctetAlligned) &&
@ -398,7 +398,7 @@ ACMAMRPackingFormat ACMAMR::AMREncoderPackingFormat() const {
return encoder_packing_format_;
}
WebRtc_Word16 ACMAMR::SetAMRDecoderPackingFormat(
int16_t ACMAMR::SetAMRDecoderPackingFormat(
ACMAMRPackingFormat packing_format) {
if ((packing_format != AMRBandwidthEfficient) &&
(packing_format != AMROctetAlligned) &&

View File

@ -23,58 +23,58 @@ enum ACMAMRPackingFormat;
class ACMAMR: public ACMGenericCodec {
public:
explicit ACMAMR(WebRtc_Word16 codec_id);
explicit ACMAMR(int16_t codec_id);
~ACMAMR();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 SetAMREncoderPackingFormat(
int16_t SetAMREncoderPackingFormat(
const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMREncoderPackingFormat() const;
WebRtc_Word16 SetAMRDecoderPackingFormat(
int16_t SetAMRDecoderPackingFormat(
const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRDecoderPackingFormat() const;
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
int16_t SetBitRateSafe(const int32_t rate);
WebRtc_Word16 EnableDTX();
int16_t EnableDTX();
WebRtc_Word16 DisableDTX();
int16_t DisableDTX();
AMR_encinst_t_* encoder_inst_ptr_;
AMR_decinst_t_* decoder_inst_ptr_;
WebRtc_Word16 encoding_mode_;
WebRtc_Word16 encoding_rate_;
int16_t encoding_mode_;
int16_t encoding_rate_;
ACMAMRPackingFormat encoder_packing_format_;
ACMAMRPackingFormat decoder_packing_format_;
};

View File

@ -47,7 +47,7 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_AMRWB
ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codec_id */)
ACMAMRwb::ACMAMRwb(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
encoding_mode_(-1), // invalid value
@ -59,40 +59,40 @@ ACMAMRwb::ACMAMRwb(WebRtc_Word16 /* codec_id */)
ACMAMRwb::~ACMAMRwb() {
}
WebRtc_Word16 ACMAMRwb::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMAMRwb::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMAMRwb::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMAMRwb::EnableDTX() {
int16_t ACMAMRwb::EnableDTX() {
return -1;
}
WebRtc_Word16 ACMAMRwb::DisableDTX() {
int16_t ACMAMRwb::DisableDTX() {
return -1;
}
WebRtc_Word16 ACMAMRwb::InternalInitEncoder(
int16_t ACMAMRwb::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMAMRwb::InternalInitDecoder(
int16_t ACMAMRwb::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -101,7 +101,7 @@ ACMAMRwb::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMAMRwb::InternalCreateEncoder() {
int16_t ACMAMRwb::InternalCreateEncoder() {
return -1;
}
@ -109,7 +109,7 @@ void ACMAMRwb::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMAMRwb::InternalCreateDecoder() {
int16_t ACMAMRwb::InternalCreateDecoder() {
return -1;
}
@ -117,7 +117,7 @@ void ACMAMRwb::DestructDecoderSafe() {
return;
}
WebRtc_Word16 ACMAMRwb::SetBitRateSafe(const WebRtc_Word32 /* rate */) {
int16_t ACMAMRwb::SetBitRateSafe(const int32_t /* rate */) {
return -1;
}
@ -125,7 +125,7 @@ void ACMAMRwb::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat(
int16_t ACMAMRwb::SetAMRwbEncoderPackingFormat(
ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@ -134,7 +134,7 @@ ACMAMRPackingFormat ACMAMRwb::AMRwbEncoderPackingFormat() const {
return AMRUndefined;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat(
int16_t ACMAMRwb::SetAMRwbDecoderPackingFormat(
ACMAMRPackingFormat /* packing_format */) {
return -1;
}
@ -155,7 +155,7 @@ ACMAMRPackingFormat ACMAMRwb::AMRwbDecoderPackingFormat() const {
#define AMRWB_MODE_23k 7
#define AMRWB_MODE_24k 8
ACMAMRwb::ACMAMRwb(WebRtc_Word16 codec_id)
ACMAMRwb::ACMAMRwb(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
encoding_mode_(-1), // invalid value
@ -179,9 +179,9 @@ ACMAMRwb::~ACMAMRwb() {
return;
}
WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 vad_decision = 1;
int16_t ACMAMRwb::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
int16_t vad_decision = 1;
// sanity check, if the rate is set correctly. we might skip this
// sanity check. if rate is not set correctly, initialization flag
// should be false and should not be here.
@ -192,7 +192,7 @@ WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitstream,
*bitstream_len_byte = WebRtcAmrWb_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
frame_len_smpl_,
(WebRtc_Word16*)bitstream,
(int16_t*)bitstream,
encoding_mode_);
// Update VAD, if internal DTX is used
@ -200,7 +200,7 @@ WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitstream,
if (*bitstream_len_byte <= (7 * frame_len_smpl_ / 160)) {
vad_decision = 0;
}
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
for (int16_t n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
vad_label_[n] = vad_decision;
}
}
@ -210,15 +210,15 @@ WebRtc_Word16 ACMAMRwb::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMAMRwb::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMAMRwb::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMAMRwb::EnableDTX() {
int16_t ACMAMRwb::EnableDTX() {
if (dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -233,7 +233,7 @@ WebRtc_Word16 ACMAMRwb::EnableDTX() {
}
}
WebRtc_Word16 ACMAMRwb::DisableDTX() {
int16_t ACMAMRwb::DisableDTX() {
if (!dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -249,14 +249,14 @@ WebRtc_Word16 ACMAMRwb::DisableDTX() {
}
}
WebRtc_Word16 ACMAMRwb::InternalInitEncoder(
int16_t ACMAMRwb::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
// sanity check
if (encoder_inst_ptr_ == NULL) {
return -1;
}
WebRtc_Word16 status = SetBitRateSafe((codec_params->codec_inst).rate);
int16_t status = SetBitRateSafe((codec_params->codec_inst).rate);
status += (WebRtcAmrWb_EncoderInit(
encoder_inst_ptr_, ((codec_params->enable_dtx) ? 1 : 0)) < 0) ? -1 : 0;
status += (WebRtcAmrWb_EncodeBitmode(
@ -264,16 +264,16 @@ WebRtc_Word16 ACMAMRwb::InternalInitEncoder(
return (status < 0) ? -1 : 0;
}
WebRtc_Word16 ACMAMRwb::InternalInitDecoder(
int16_t ACMAMRwb::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
WebRtc_Word16 status = WebRtcAmrWb_DecodeBitmode(decoder_inst_ptr_,
int16_t status = WebRtcAmrWb_DecodeBitmode(decoder_inst_ptr_,
decoder_packing_format_);
status += ((WebRtcAmrWb_DecoderInit(decoder_inst_ptr_) < 0) ? -1 : 0);
return (status < 0) ? -1 : 0;
}
WebRtc_Word32 ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMAMRwb::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
return -1;
}
@ -292,7 +292,7 @@ ACMGenericCodec* ACMAMRwb::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMAMRwb::InternalCreateEncoder() {
int16_t ACMAMRwb::InternalCreateEncoder() {
return WebRtcAmrWb_CreateEnc(&encoder_inst_ptr_);
}
@ -308,7 +308,7 @@ void ACMAMRwb::DestructEncoderSafe() {
encoding_rate_ = 0;
}
WebRtc_Word16 ACMAMRwb::InternalCreateDecoder() {
int16_t ACMAMRwb::InternalCreateDecoder() {
return WebRtcAmrWb_CreateDec(&decoder_inst_ptr_);
}
@ -322,7 +322,7 @@ void ACMAMRwb::DestructDecoderSafe() {
decoder_initialized_ = false;
}
WebRtc_Word16 ACMAMRwb::SetBitRateSafe(const WebRtc_Word32 rate) {
int16_t ACMAMRwb::SetBitRateSafe(const int32_t rate) {
switch (rate) {
case 7000: {
encoding_mode_ = AMRWB_MODE_7k;
@ -383,7 +383,7 @@ void ACMAMRwb::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbEncoderPackingFormat(
int16_t ACMAMRwb::SetAMRwbEncoderPackingFormat(
ACMAMRPackingFormat packing_format) {
if ((packing_format != AMRBandwidthEfficient) &&
(packing_format != AMROctetAlligned) &&
@ -405,7 +405,7 @@ ACMAMRPackingFormat ACMAMRwb::AMRwbEncoderPackingFormat() const {
return encoder_packing_format_;
}
WebRtc_Word16 ACMAMRwb::SetAMRwbDecoderPackingFormat(
int16_t ACMAMRwb::SetAMRwbDecoderPackingFormat(
ACMAMRPackingFormat packing_format) {
if ((packing_format != AMRBandwidthEfficient) &&
(packing_format != AMROctetAlligned) &&

View File

@ -21,59 +21,59 @@ namespace webrtc {
class ACMAMRwb: public ACMGenericCodec {
public:
explicit ACMAMRwb(WebRtc_Word16 codec_id);
explicit ACMAMRwb(int16_t codec_id);
~ACMAMRwb();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams* codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams* codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams* codec_params);
WebRtc_Word16 SetAMRwbEncoderPackingFormat(
int16_t SetAMRwbEncoderPackingFormat(
const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRwbEncoderPackingFormat() const;
WebRtc_Word16 SetAMRwbDecoderPackingFormat(
int16_t SetAMRwbDecoderPackingFormat(
const ACMAMRPackingFormat packing_format);
ACMAMRPackingFormat AMRwbDecoderPackingFormat() const;
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
int16_t SetBitRateSafe(const int32_t rate);
WebRtc_Word16 EnableDTX();
int16_t EnableDTX();
WebRtc_Word16 DisableDTX();
int16_t DisableDTX();
AMRWB_encinst_t_* encoder_inst_ptr_;
AMRWB_decinst_t_* decoder_inst_ptr_;
WebRtc_Word16 encoding_mode_;
WebRtc_Word16 encoding_rate_;
int16_t encoding_mode_;
int16_t encoding_rate_;
ACMAMRPackingFormat encoder_packing_format_;
ACMAMRPackingFormat decoder_packing_format_;
};

View File

@ -49,7 +49,7 @@ int16_t ACMCELT::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int8_t* /* speech_type */) {
return -1;
}
@ -156,7 +156,7 @@ int16_t ACMCELT::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int8_t* /* speech_type */) {
return 0;
}

View File

@ -33,14 +33,12 @@ class ACMCELT : public ACMGenericCodec {
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(
int16_t DecodeSafe(
uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
// TODO(leozwang): use int8_t here when WebRtc_Word8 is properly typed.
// http://code.google.com/p/webrtc/issues/detail?id=311
WebRtc_Word8* /* speech_type */);
int8_t* /* speech_type */);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);

View File

@ -20,7 +20,7 @@
namespace webrtc {
ACMCNG::ACMCNG(WebRtc_Word16 codec_id) {
ACMCNG::ACMCNG(int16_t codec_id) {
encoder_inst_ptr_ = NULL;
decoder_inst_ptr_ = NULL;
codec_id_ = codec_id;
@ -44,16 +44,16 @@ ACMCNG::~ACMCNG() {
// should not be called normally
// instead the following function is called from inside
// ACMGenericCodec::ProcessFrameVADDTX
WebRtc_Word16 ACMCNG::InternalEncode(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMCNG::InternalEncode(uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMCNG::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMCNG::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
@ -61,18 +61,18 @@ WebRtc_Word16 ACMCNG::DecodeSafe(WebRtc_UWord8* /* bitstream */,
// this function should not be called normally
// instead the following function is called from inside
// ACMGenericCodec::ProcessFrameVADDTX
WebRtc_Word16 ACMCNG::InternalInitEncoder(
int16_t ACMCNG::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMCNG::InternalInitDecoder(
int16_t ACMCNG::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return WebRtcCng_InitDec(decoder_inst_ptr_);
}
WebRtc_Word32 ACMCNG::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMCNG::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// TODO(tlegrand): log error
return -1;
@ -97,7 +97,7 @@ ACMGenericCodec* ACMCNG::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMCNG::InternalCreateEncoder() {
int16_t ACMCNG::InternalCreateEncoder() {
if (WebRtcCng_CreateEnc(&encoder_inst_ptr_) < 0) {
encoder_inst_ptr_ = NULL;
return -1;
@ -115,7 +115,7 @@ void ACMCNG::DestructEncoderSafe() {
encoder_initialized_ = false;
}
WebRtc_Word16 ACMCNG::InternalCreateDecoder() {
int16_t ACMCNG::InternalCreateDecoder() {
if (WebRtcCng_CreateDec(&decoder_inst_ptr_) < 0) {
decoder_inst_ptr_ = NULL;
return -1;

View File

@ -21,49 +21,49 @@ namespace webrtc {
class ACMCNG: public ACMGenericCodec {
public:
explicit ACMCNG(WebRtc_Word16 codec_id);
explicit ACMCNG(int16_t codec_id);
~ACMCNG();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX() {
int16_t EnableDTX() {
return -1;
}
WebRtc_Word16 DisableDTX() {
int16_t DisableDTX() {
return -1;
}
WebRtcCngEncInst* encoder_inst_ptr_;
WebRtcCngDecInst* decoder_inst_ptr_;
WebRtc_UWord16 samp_freq_hz_;
uint16_t samp_freq_hz_;
};
} // namespace webrtc

View File

@ -103,13 +103,13 @@ struct WebRtcACMCodecParams {
// last_in_timestamp: same as AudioCodingModuleImpl::last_in_timestamp_
//
struct WebRtcACMAudioBuff {
WebRtc_Word16 in_audio[AUDIO_BUFFER_SIZE_W16];
WebRtc_Word16 in_audio_ix_read;
WebRtc_Word16 in_audio_ix_write;
WebRtc_UWord32 in_timestamp[TIMESTAMP_BUFFER_SIZE_W32];
WebRtc_Word16 in_timestamp_ix_write;
WebRtc_UWord32 last_timestamp;
WebRtc_UWord32 last_in_timestamp;
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

View File

@ -18,20 +18,20 @@ ACMDTMFDetection::ACMDTMFDetection() {}
ACMDTMFDetection::~ACMDTMFDetection() {}
WebRtc_Word16 ACMDTMFDetection::Enable(ACMCountries /* cpt */) {
int16_t ACMDTMFDetection::Enable(ACMCountries /* cpt */) {
return -1;
}
WebRtc_Word16 ACMDTMFDetection::Disable() {
int16_t ACMDTMFDetection::Disable() {
return -1;
}
WebRtc_Word16 ACMDTMFDetection::Detect(
const WebRtc_Word16* /* in_audio_buff */,
const WebRtc_UWord16 /* in_buff_len_word16 */,
const WebRtc_Word32 /* in_freq_hz */,
int16_t ACMDTMFDetection::Detect(
const int16_t* /* in_audio_buff */,
const uint16_t /* in_buff_len_word16 */,
const int32_t /* in_freq_hz */,
bool& /* tone_detected */,
WebRtc_Word16& /* tone */) {
int16_t& /* tone */) {
return -1;
}

View File

@ -21,13 +21,13 @@ class ACMDTMFDetection {
public:
ACMDTMFDetection();
~ACMDTMFDetection();
WebRtc_Word16 Enable(ACMCountries cpt = ACMDisableCountryDetection);
WebRtc_Word16 Disable();
WebRtc_Word16 Detect(const WebRtc_Word16* in_audio_buff,
const WebRtc_UWord16 in_buff_len_word16,
const WebRtc_Word32 in_freq_hz,
bool& tone_detected,
WebRtc_Word16& tone);
int16_t Enable(ACMCountries cpt = ACMDisableCountryDetection);
int16_t Disable();
int16_t Detect(const int16_t* in_audio_buff,
const uint16_t in_buff_len_word16,
const int32_t in_freq_hz,
bool& tone_detected,
int16_t& tone);
private:
ACMResampler resampler_;

View File

@ -21,7 +21,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_AVT
ACMDTMFPlayout::ACMDTMFPlayout(
WebRtc_Word16 /* codec_id */) {
int16_t /* codec_id */) {
return;
}
@ -29,33 +29,33 @@ ACMDTMFPlayout::~ACMDTMFPlayout() {
return;
}
WebRtc_Word16 ACMDTMFPlayout::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMDTMFPlayout::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMDTMFPlayout::DecodeSafe(
uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder(
int16_t ACMDTMFPlayout::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder(
int16_t ACMDTMFPlayout::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -63,11 +63,11 @@ ACMGenericCodec* ACMDTMFPlayout::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMDTMFPlayout::InternalCreateEncoder() {
int16_t ACMDTMFPlayout::InternalCreateEncoder() {
return -1;
}
WebRtc_Word16 ACMDTMFPlayout::InternalCreateDecoder() {
int16_t ACMDTMFPlayout::InternalCreateDecoder() {
return -1;
}
@ -85,7 +85,7 @@ void ACMDTMFPlayout::DestructDecoderSafe() {
#else //===================== Actual Implementation =======================
ACMDTMFPlayout::ACMDTMFPlayout(WebRtc_Word16 codec_id) {
ACMDTMFPlayout::ACMDTMFPlayout(int16_t codec_id) {
codec_id_ = codec_id;
}
@ -93,37 +93,37 @@ ACMDTMFPlayout::~ACMDTMFPlayout() {
return;
}
WebRtc_Word16 ACMDTMFPlayout::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMDTMFPlayout::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::DecodeSafe(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMDTMFPlayout::DecodeSafe(
uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitEncoder(
int16_t ACMDTMFPlayout::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// DTMFPlayout has no instance
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::InternalInitDecoder(
int16_t ACMDTMFPlayout::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// DTMFPlayout has no instance
return 0;
}
WebRtc_Word32 ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMDTMFPlayout::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_AVT_FUNCTION."
// Then call NetEQ to add the codec to it's
@ -137,12 +137,12 @@ ACMGenericCodec* ACMDTMFPlayout::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMDTMFPlayout::InternalCreateEncoder() {
int16_t ACMDTMFPlayout::InternalCreateEncoder() {
// DTMFPlayout has no instance
return 0;
}
WebRtc_Word16 ACMDTMFPlayout::InternalCreateDecoder() {
int16_t ACMDTMFPlayout::InternalCreateDecoder() {
// DTMFPlayout has no instance
return 0;
}

View File

@ -17,35 +17,34 @@ namespace webrtc {
class ACMDTMFPlayout: public ACMGenericCodec {
public:
explicit ACMDTMFPlayout(WebRtc_Word16 codec_id);
explicit ACMDTMFPlayout(int16_t codec_id);
~ACMDTMFPlayout();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
};

View File

@ -22,7 +22,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_G722
ACMG722::ACMG722(WebRtc_Word16 /* codec_id */)
ACMG722::ACMG722(int16_t /* codec_id */)
: ptr_enc_str_(NULL),
ptr_dec_str_(NULL),
encoder_inst_ptr_(NULL),
@ -31,40 +31,40 @@ ACMG722::ACMG722(WebRtc_Word16 /* codec_id */)
ACMG722::~ACMG722() {}
WebRtc_Word32 ACMG722::Add10MsDataSafe(
const WebRtc_UWord32 /* timestamp */,
const WebRtc_Word16* /* data */,
const WebRtc_UWord16 /* length_smpl */,
const WebRtc_UWord8 /* audio_channel */) {
int32_t ACMG722::Add10MsDataSafe(
const uint32_t /* timestamp */,
const int16_t* /* data */,
const uint16_t /* length_smpl */,
const uint8_t /* audio_channel */) {
return -1;
}
WebRtc_Word16 ACMG722::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMG722::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722::InternalInitEncoder(
int16_t ACMG722::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722::InternalInitDecoder(
int16_t ACMG722::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMG722::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -72,7 +72,7 @@ ACMGenericCodec* ACMG722::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722::InternalCreateEncoder() {
int16_t ACMG722::InternalCreateEncoder() {
return -1;
}
@ -80,7 +80,7 @@ void ACMG722::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMG722::InternalCreateDecoder() {
int16_t ACMG722::InternalCreateDecoder() {
return -1;
}
@ -107,7 +107,7 @@ struct ACMG722DecStr {
G722DecInst* inst_right; // instance for right channel in case of stereo
};
ACMG722::ACMG722(WebRtc_Word16 codec_id)
ACMG722::ACMG722(int16_t codec_id)
: encoder_inst_ptr_(NULL),
encoder_inst_ptr_right_(NULL),
decoder_inst_ptr_(NULL) {
@ -157,33 +157,33 @@ ACMG722::~ACMG722() {
return;
}
WebRtc_Word32 ACMG722::Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length_smpl,
const WebRtc_UWord8 audio_channel) {
int32_t ACMG722::Add10MsDataSafe(const uint32_t timestamp,
const int16_t* data,
const uint16_t length_smpl,
const uint8_t audio_channel) {
return ACMGenericCodec::Add10MsDataSafe((timestamp >> 1), data, length_smpl,
audio_channel);
}
WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMG722::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
// If stereo, split input signal in left and right channel before encoding
if (num_channels_ == 2) {
WebRtc_Word16 left_channel[960];
WebRtc_Word16 right_channel[960];
WebRtc_UWord8 out_left[480];
WebRtc_UWord8 out_right[480];
WebRtc_Word16 len_in_bytes;
int16_t left_channel[960];
int16_t right_channel[960];
uint8_t out_left[480];
uint8_t out_right[480];
int16_t len_in_bytes;
for (int i = 0, j = 0; i < frame_len_smpl_ * 2; i += 2, j++) {
left_channel[j] = in_audio_[in_audio_ix_read_ + i];
right_channel[j] = in_audio_[in_audio_ix_read_ + i + 1];
}
len_in_bytes = WebRtcG722_Encode(encoder_inst_ptr_, left_channel,
frame_len_smpl_,
(WebRtc_Word16*)out_left);
(int16_t*)out_left);
len_in_bytes += WebRtcG722_Encode(encoder_inst_ptr_right_, right_channel,
frame_len_smpl_,
(WebRtc_Word16*)out_right);
(int16_t*)out_right);
*bitstream_len_byte = len_in_bytes;
// Interleave the 4 bits per sample from left and right channel
@ -195,7 +195,7 @@ WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitstream,
*bitstream_len_byte = WebRtcG722_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
frame_len_smpl_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
}
// increment the read index this tell the caller how far
@ -204,15 +204,15 @@ WebRtc_Word16 ACMG722::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMG722::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
if (codec_params->codec_inst.channels == 2) {
// Create codec struct for right channel
if (ptr_enc_str_->inst_right == NULL) {
@ -230,13 +230,13 @@ WebRtc_Word16 ACMG722::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
return WebRtcG722_EncoderInit(encoder_inst_ptr_);
}
WebRtc_Word16 ACMG722::InternalInitDecoder(
int16_t ACMG722::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return WebRtcG722_DecoderInit(decoder_inst_ptr_);
}
WebRtc_Word32 ACMG722::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMG722::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// TODO(turajs): log error
return -1;
@ -260,7 +260,7 @@ ACMGenericCodec* ACMG722::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722::InternalCreateEncoder() {
int16_t ACMG722::InternalCreateEncoder() {
if (ptr_enc_str_ == NULL) {
// this structure must be created at the costructor
// if it is still NULL then there is a probelm and
@ -286,7 +286,7 @@ void ACMG722::DestructEncoderSafe() {
encoder_initialized_ = false;
}
WebRtc_Word16 ACMG722::InternalCreateDecoder() {
int16_t ACMG722::InternalCreateDecoder() {
if (ptr_dec_str_ == NULL) {
// this structure must be created at the costructor
// if it is still NULL then there is a probelm and

View File

@ -24,40 +24,39 @@ struct ACMG722DecStr;
class ACMG722: public ACMGenericCodec {
public:
explicit ACMG722(WebRtc_Word16 codec_id);
explicit ACMG722(int16_t codec_id);
~ACMG722();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length_smpl,
const WebRtc_UWord8 audio_channel);
int32_t Add10MsDataSafe(const uint32_t timestamp,
const int16_t* data,
const uint16_t length_smpl,
const uint8_t audio_channel);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);

View File

@ -88,7 +88,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_G722_1
ACMG722_1::ACMG722_1(WebRtc_Word16 /* codec_id */)
ACMG722_1::ACMG722_1(int16_t /* codec_id */)
: operational_rate_(-1),
encoder_inst_ptr_(NULL),
encoder_inst_ptr_right_(NULL),
@ -109,32 +109,32 @@ ACMG722_1::~ACMG722_1() {
return;
}
WebRtc_Word16 ACMG722_1::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMG722_1::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722_1::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722_1::InternalInitEncoder(
int16_t ACMG722_1::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722_1::InternalInitDecoder(
int16_t ACMG722_1::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -142,7 +142,7 @@ ACMGenericCodec* ACMG722_1::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722_1::InternalCreateEncoder() {
int16_t ACMG722_1::InternalCreateEncoder() {
return -1;
}
@ -150,7 +150,7 @@ void ACMG722_1::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMG722_1::InternalCreateDecoder() {
int16_t ACMG722_1::InternalCreateDecoder() {
return -1;
}
@ -163,7 +163,7 @@ void ACMG722_1::InternalDestructEncoderInst(void* /* ptr_inst */) {
}
#else //===================== Actual Implementation =======================
ACMG722_1::ACMG722_1(WebRtc_Word16 codec_id)
ACMG722_1::ACMG722_1(int16_t codec_id)
: encoder_inst_ptr_(NULL),
encoder_inst_ptr_right_(NULL),
decoder_inst_ptr_(NULL),
@ -229,12 +229,12 @@ ACMG722_1::~ACMG722_1() {
return;
}
WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 left_channel[320];
WebRtc_Word16 right_channel[320];
WebRtc_Word16 len_in_bytes;
WebRtc_Word16 out_bits[160];
int16_t ACMG722_1::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
int16_t left_channel[320];
int16_t right_channel[320];
int16_t len_in_bytes;
int16_t out_bits[160];
// If stereo, split input signal in left and right channel before encoding
if (num_channels_ == 2) {
@ -292,17 +292,17 @@ WebRtc_Word16 ACMG722_1::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMG722_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722_1::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG722_1::InternalInitEncoder(
int16_t ACMG722_1::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
WebRtc_Word16 ret;
int16_t ret;
switch (operational_rate_) {
case 16000: {
@ -334,7 +334,7 @@ WebRtc_Word16 ACMG722_1::InternalInitEncoder(
}
}
WebRtc_Word16 ACMG722_1::InternalInitDecoder(
int16_t ACMG722_1::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
switch (operational_rate_) {
case 16000: {
@ -354,8 +354,8 @@ WebRtc_Word16 ACMG722_1::InternalInitDecoder(
}
}
WebRtc_Word32 ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMG722_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// Todo:
// log error
@ -401,7 +401,7 @@ ACMGenericCodec* ACMG722_1::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722_1::InternalCreateEncoder() {
int16_t ACMG722_1::InternalCreateEncoder() {
if ((encoder_inst_ptr_ == NULL) || (encoder_inst_ptr_right_ == NULL)) {
return -1;
}
@ -446,7 +446,7 @@ void ACMG722_1::DestructEncoderSafe() {
encoder_inst32_ptr_ = NULL;
}
WebRtc_Word16 ACMG722_1::InternalCreateDecoder() {
int16_t ACMG722_1::InternalCreateDecoder() {
if (decoder_inst_ptr_ == NULL) {
return -1;
}

View File

@ -26,39 +26,38 @@ namespace webrtc {
class ACMG722_1: public ACMGenericCodec {
public:
explicit ACMG722_1(WebRtc_Word16 codec_id);
explicit ACMG722_1(int16_t codec_id);
~ACMG722_1();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio, WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio, int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word32 operational_rate_;
int32_t operational_rate_;
G722_1_Inst_t_* encoder_inst_ptr_;
G722_1_Inst_t_* encoder_inst_ptr_right_; // Used in stereo mode

View File

@ -89,7 +89,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_G722_1C
ACMG722_1C::ACMG722_1C(WebRtc_Word16 /* codec_id */)
ACMG722_1C::ACMG722_1C(int16_t /* codec_id */)
: operational_rate_(-1),
encoder_inst_ptr_(NULL),
encoder_inst_ptr_right_(NULL),
@ -110,32 +110,32 @@ ACMG722_1C::~ACMG722_1C() {
return;
}
WebRtc_Word16 ACMG722_1C::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMG722_1C::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722_1C::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG722_1C::InternalInitEncoder(
int16_t ACMG722_1C::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG722_1C::InternalInitDecoder(
int16_t ACMG722_1C::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -143,7 +143,7 @@ ACMGenericCodec* ACMG722_1C::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722_1C::InternalCreateEncoder() {
int16_t ACMG722_1C::InternalCreateEncoder() {
return -1;
}
@ -151,7 +151,7 @@ void ACMG722_1C::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMG722_1C::InternalCreateDecoder() {
int16_t ACMG722_1C::InternalCreateDecoder() {
return -1;
}
@ -164,7 +164,7 @@ void ACMG722_1C::InternalDestructEncoderInst(void* /* ptr_inst */) {
}
#else //===================== Actual Implementation =======================
ACMG722_1C::ACMG722_1C(WebRtc_Word16 codec_id)
ACMG722_1C::ACMG722_1C(int16_t codec_id)
: encoder_inst_ptr_(NULL),
encoder_inst_ptr_right_(NULL),
decoder_inst_ptr_(NULL),
@ -234,12 +234,12 @@ ACMG722_1C::~ACMG722_1C() {
return;
}
WebRtc_Word16 ACMG722_1C::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 left_channel[640];
WebRtc_Word16 right_channel[640];
WebRtc_Word16 len_in_bytes;
WebRtc_Word16 out_bits[240];
int16_t ACMG722_1C::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
int16_t left_channel[640];
int16_t right_channel[640];
int16_t len_in_bytes;
int16_t out_bits[240];
// If stereo, split input signal in left and right channel before encoding
if (num_channels_ == 2) {
@ -299,17 +299,17 @@ WebRtc_Word16 ACMG722_1C::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMG722_1C::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG722_1C::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG722_1C::InternalInitEncoder(
int16_t ACMG722_1C::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
WebRtc_Word16 ret;
int16_t ret;
switch (operational_rate_) {
case 24000: {
@ -341,7 +341,7 @@ WebRtc_Word16 ACMG722_1C::InternalInitEncoder(
}
}
WebRtc_Word16 ACMG722_1C::InternalInitDecoder(
int16_t ACMG722_1C::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
switch (operational_rate_) {
case 24000: {
@ -361,8 +361,8 @@ WebRtc_Word16 ACMG722_1C::InternalInitDecoder(
}
}
WebRtc_Word32 ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMG722_1C::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: decoder not initialized for G722_1c");
@ -409,7 +409,7 @@ ACMG722_1C::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG722_1C::InternalCreateEncoder() {
int16_t ACMG722_1C::InternalCreateEncoder() {
if ((encoder_inst_ptr_ == NULL) || (encoder_inst_ptr_right_ == NULL)) {
return -1;
}
@ -454,7 +454,7 @@ void ACMG722_1C::DestructEncoderSafe() {
encoder_inst48_ptr_ = NULL;
}
WebRtc_Word16 ACMG722_1C::InternalCreateDecoder() {
int16_t ACMG722_1C::InternalCreateDecoder() {
if (decoder_inst_ptr_ == NULL) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: cannot create decoder");

View File

@ -26,31 +26,31 @@ namespace webrtc {
class ACMG722_1C : public ACMGenericCodec {
public:
explicit ACMG722_1C(WebRtc_Word16 codec_id);
explicit ACMG722_1C(int16_t codec_id);
~ACMG722_1C();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(
WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(
uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(
int16_t InternalInitEncoder(
WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(
int16_t InternalInitDecoder(
WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(
WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(
uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(
int32_t CodecDef(
WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
@ -58,14 +58,14 @@ class ACMG722_1C : public ACMGenericCodec {
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(
void* ptr_inst);
WebRtc_Word32 operational_rate_;
int32_t operational_rate_;
G722_1_Inst_t_* encoder_inst_ptr_;
G722_1_Inst_t_* encoder_inst_ptr_right_; // Used in stereo mode

View File

@ -27,7 +27,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_G729
ACMG729::ACMG729(WebRtc_Word16 /* codec_id */)
ACMG729::ACMG729(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
return;
@ -37,50 +37,50 @@ ACMG729::~ACMG729() {
return;
}
WebRtc_Word16 ACMG729::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMG729::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMG729::EnableDTX() {
int16_t ACMG729::EnableDTX() {
return -1;
}
WebRtc_Word16 ACMG729::DisableDTX() {
int16_t ACMG729::DisableDTX() {
return -1;
}
WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(
int32_t ACMG729::ReplaceInternalDTXSafe(
const bool /*replace_internal_dtx */) {
return -1;
}
WebRtc_Word32 ACMG729::IsInternalDTXReplacedSafe(
int32_t ACMG729::IsInternalDTXReplacedSafe(
bool* /* internal_dtx_replaced */) {
return -1;
}
WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG729::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG729::InternalInitEncoder(
int16_t ACMG729::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG729::InternalInitDecoder(
int16_t ACMG729::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMG729::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -88,7 +88,7 @@ ACMGenericCodec* ACMG729::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG729::InternalCreateEncoder() {
int16_t ACMG729::InternalCreateEncoder() {
return -1;
}
@ -96,7 +96,7 @@ void ACMG729::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMG729::InternalCreateDecoder() {
int16_t ACMG729::InternalCreateDecoder() {
return -1;
}
@ -109,7 +109,7 @@ void ACMG729::InternalDestructEncoderInst(void* /* ptr_inst */) {
}
#else //===================== Actual Implementation =======================
ACMG729::ACMG729(WebRtc_Word16 codec_id)
ACMG729::ACMG729(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
codec_id_ = codec_id;
@ -131,19 +131,19 @@ ACMG729::~ACMG729() {
return;
}
WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMG729::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
// Initialize before entering the loop
WebRtc_Word16 num_encoded_samples = 0;
WebRtc_Word16 tmp_len_byte = 0;
WebRtc_Word16 vad_decision = 0;
int16_t num_encoded_samples = 0;
int16_t tmp_len_byte = 0;
int16_t vad_decision = 0;
*bitstream_len_byte = 0;
while (num_encoded_samples < frame_len_smpl_) {
// Call G.729 encoder with pointer to encoder memory, input
// audio, number of samples and bitsream
tmp_len_byte = WebRtcG729_Encode(
encoder_inst_ptr_, &in_audio_[in_audio_ix_read_], 80,
(WebRtc_Word16*)(&(bitstream[*bitstream_len_byte])));
(int16_t*)(&(bitstream[*bitstream_len_byte])));
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
@ -173,7 +173,7 @@ WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitstream,
// check if G.729 internal DTX is enabled
if (has_internal_dtx_ && dtx_enabled_) {
vad_decision = 0;
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
for (int16_t n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
vad_label_[n] = vad_decision;
}
}
@ -197,7 +197,7 @@ WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitstream,
// update VAD decision vector
if (has_internal_dtx_ && !vad_decision && dtx_enabled_) {
for (WebRtc_Word16 n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
for (int16_t n = 0; n < MAX_FRAME_SIZE_10MSEC; n++) {
vad_label_[n] = vad_decision;
}
}
@ -206,7 +206,7 @@ WebRtc_Word16 ACMG729::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMG729::EnableDTX() {
int16_t ACMG729::EnableDTX() {
if (dtx_enabled_) {
// DTX already enabled, do nothing
return 0;
@ -222,7 +222,7 @@ WebRtc_Word16 ACMG729::EnableDTX() {
}
}
WebRtc_Word16 ACMG729::DisableDTX() {
int16_t ACMG729::DisableDTX() {
if (!dtx_enabled_) {
// DTX already dissabled, do nothing
return 0;
@ -239,7 +239,7 @@ WebRtc_Word16 ACMG729::DisableDTX() {
}
}
WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(const bool replace_internal_dtx) {
int32_t ACMG729::ReplaceInternalDTXSafe(const bool replace_internal_dtx) {
// This function is used to disable the G.729 built in DTX and use an
// external instead.
@ -256,7 +256,7 @@ WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(const bool replace_internal_dtx) {
ACMGenericCodec::DisableDTX();
}
has_internal_dtx_ = !replace_internal_dtx;
WebRtc_Word16 status = SetVADSafe(old_enable_dtx, old_enable_vad, old_mode);
int16_t status = SetVADSafe(old_enable_dtx, old_enable_vad, old_mode);
// Check if VAD status has changed from inactive to active, or if error was
// reported
if (status == 1) {
@ -270,35 +270,35 @@ WebRtc_Word32 ACMG729::ReplaceInternalDTXSafe(const bool replace_internal_dtx) {
return 0;
}
WebRtc_Word32 ACMG729::IsInternalDTXReplacedSafe(bool* internal_dtx_replaced) {
int32_t ACMG729::IsInternalDTXReplacedSafe(bool* internal_dtx_replaced) {
// Get status of wether DTX is replaced or not
*internal_dtx_replaced = !has_internal_dtx_;
return 0;
}
WebRtc_Word16 ACMG729::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG729::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
// This function is not used. G.729 decoder is called from inside NetEQ
return 0;
}
WebRtc_Word16 ACMG729::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMG729::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// Init G.729 encoder
return WebRtcG729_EncoderInit(encoder_inst_ptr_,
((codec_params->enable_dtx) ? 1 : 0));
}
WebRtc_Word16 ACMG729::InternalInitDecoder(
int16_t ACMG729::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// Init G.729 decoder
return WebRtcG729_DecoderInit(decoder_inst_ptr_);
}
WebRtc_Word32 ACMG729::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMG729::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// Todo:
// log error
@ -320,7 +320,7 @@ ACMGenericCodec* ACMG729::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG729::InternalCreateEncoder() {
int16_t ACMG729::InternalCreateEncoder() {
// Create encoder memory
return WebRtcG729_CreateEnc(&encoder_inst_ptr_);
}
@ -335,7 +335,7 @@ void ACMG729::DestructEncoderSafe() {
}
}
WebRtc_Word16 ACMG729::InternalCreateDecoder() {
int16_t ACMG729::InternalCreateDecoder() {
// Create decoder memory
return WebRtcG729_CreateDec(&decoder_inst_ptr_);
}

View File

@ -21,46 +21,46 @@ namespace webrtc {
class ACMG729 : public ACMGenericCodec {
public:
explicit ACMG729(WebRtc_Word16 codec_id);
explicit ACMG729(int16_t codec_id);
~ACMG729();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX();
int16_t EnableDTX();
WebRtc_Word16 DisableDTX();
int16_t DisableDTX();
WebRtc_Word32 ReplaceInternalDTXSafe(const bool replace_internal_dtx);
int32_t ReplaceInternalDTXSafe(const bool replace_internal_dtx);
WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
int32_t IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
G729_encinst_t_* encoder_inst_ptr_;
G729_decinst_t_* decoder_inst_ptr_;

View File

@ -26,7 +26,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_G729_1
ACMG729_1::ACMG729_1(WebRtc_Word16 /* codec_id */)
ACMG729_1::ACMG729_1(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
my_rate_(32000),
@ -39,32 +39,32 @@ ACMG729_1::~ACMG729_1() {
return;
}
WebRtc_Word16 ACMG729_1::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMG729_1::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG729_1::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMG729_1::InternalInitEncoder(
int16_t ACMG729_1::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMG729_1::InternalInitDecoder(
int16_t ACMG729_1::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -72,7 +72,7 @@ ACMGenericCodec* ACMG729_1::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG729_1::InternalCreateEncoder() {
int16_t ACMG729_1::InternalCreateEncoder() {
return -1;
}
@ -80,7 +80,7 @@ void ACMG729_1::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMG729_1::InternalCreateDecoder() {
int16_t ACMG729_1::InternalCreateDecoder() {
return -1;
}
@ -92,7 +92,7 @@ void ACMG729_1::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMG729_1::SetBitRateSafe(const WebRtc_Word32 /*rate*/) {
int16_t ACMG729_1::SetBitRateSafe(const int32_t /*rate*/) {
return -1;
}
@ -100,7 +100,7 @@ WebRtc_Word16 ACMG729_1::SetBitRateSafe(const WebRtc_Word32 /*rate*/) {
struct G729_1_inst_t_;
ACMG729_1::ACMG729_1(WebRtc_Word16 codec_id)
ACMG729_1::ACMG729_1(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
my_rate_(32000), // Default rate.
@ -124,18 +124,18 @@ ACMG729_1::~ACMG729_1() {
return;
}
WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMG729_1::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
// Initialize before entering the loop
WebRtc_Word16 num_encoded_samples = 0;
int16_t num_encoded_samples = 0;
*bitstream_len_byte = 0;
WebRtc_Word16 byte_length_frame = 0;
int16_t byte_length_frame = 0;
// Derive number of 20ms frames per encoded packet.
// [1,2,3] <=> [20,40,60]ms <=> [320,640,960] samples
WebRtc_Word16 num_20ms_frames = (frame_len_smpl_ / 320);
int16_t num_20ms_frames = (frame_len_smpl_ / 320);
// Byte length for the frame. +1 is for rate information.
byte_length_frame = my_rate_ / (8 * 50) * num_20ms_frames + (1 -
flag_g729_mode_);
@ -144,7 +144,7 @@ WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* bitstream,
do {
*bitstream_len_byte = WebRtcG7291_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
(WebRtc_Word16*) bitstream,
(int16_t*) bitstream,
my_rate_, num_20ms_frames);
// increment the read index this tell the caller that how far
@ -179,22 +179,22 @@ WebRtc_Word16 ACMG729_1::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMG729_1::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMG729_1::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMG729_1::InternalInitEncoder(
int16_t ACMG729_1::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
//set the bit rate and initialize
my_rate_ = codec_params->codec_inst.rate;
return SetBitRateSafe((WebRtc_UWord32) my_rate_);
return SetBitRateSafe((uint32_t) my_rate_);
}
WebRtc_Word16 ACMG729_1::InternalInitDecoder(
int16_t ACMG729_1::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
if (WebRtcG7291_DecoderInit(decoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
@ -204,8 +204,8 @@ WebRtc_Word16 ACMG729_1::InternalInitDecoder(
return 0;
}
WebRtc_Word32 ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMG729_1::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: Decoder uninitialized for G729_1");
@ -226,7 +226,7 @@ ACMGenericCodec* ACMG729_1::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMG729_1::InternalCreateEncoder() {
int16_t ACMG729_1::InternalCreateEncoder() {
if (WebRtcG7291_Create(&encoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: create encoder failed for G729_1");
@ -244,7 +244,7 @@ void ACMG729_1::DestructEncoderSafe() {
}
}
WebRtc_Word16 ACMG729_1::InternalCreateDecoder() {
int16_t ACMG729_1::InternalCreateDecoder() {
if (WebRtcG7291_Create(&decoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: create decoder failed for G729_1");
@ -269,7 +269,7 @@ void ACMG729_1::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
WebRtc_Word16 ACMG729_1::SetBitRateSafe(const WebRtc_Word32 rate) {
int16_t ACMG729_1::SetBitRateSafe(const int32_t rate) {
// allowed rates: { 8000, 12000, 14000, 16000, 18000, 20000,
// 22000, 24000, 26000, 28000, 30000, 32000};
// TODO(tlegrand): This check exists in one other place two. Should be

View File

@ -21,47 +21,46 @@ namespace webrtc {
class ACMG729_1 : public ACMGenericCodec {
public:
explicit ACMG729_1(WebRtc_Word16 codec_id);
explicit ACMG729_1(int16_t codec_id);
~ACMG729_1();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
int16_t SetBitRateSafe(const int32_t rate);
G729_1_inst_t_* encoder_inst_ptr_;
G729_1_inst_t_* decoder_inst_ptr_;
WebRtc_UWord16 my_rate_;
WebRtc_Word16 flag_8khz_;
WebRtc_Word16 flag_g729_mode_;
uint16_t my_rate_;
int16_t flag_8khz_;
int16_t flag_g729_mode_;
};
} // namespace webrtc

View File

@ -48,7 +48,7 @@ class ACMGenericCodec {
virtual ACMGenericCodec* CreateInstance() = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 Encode()
// int16_t Encode()
// The function is called to perform an encoding of the audio stored in
// audio buffer. An encoding is performed only if enough audio, i.e. equal
// to the frame-size of the codec, exist. The audio frame will be processed
@ -100,13 +100,13 @@ class ACMGenericCodec {
// -1 if error is occurred, otherwise the length of the bit-stream in
// bytes.
//
WebRtc_Word16 Encode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte,
WebRtc_UWord32* timestamp,
WebRtcACMEncodingType* encoding_type);
int16_t Encode(uint8_t* bitstream,
int16_t* bitstream_len_byte,
uint32_t* timestamp,
WebRtcACMEncodingType* encoding_type);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 Decode()
// int16_t Decode()
// This function is used to decode a given bit-stream, without engaging
// NetEQ.
//
@ -127,11 +127,11 @@ class ACMGenericCodec {
// -1 if failed to decode,
// 0 if succeeded.
//
WebRtc_Word16 Decode(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t Decode(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
///////////////////////////////////////////////////////////////////////////
// void SplitStereoPacket()
@ -149,8 +149,8 @@ class ACMGenericCodec {
// we simply copy the data and return it both for
// left channel and right channel decoding.
//
virtual void SplitStereoPacket(WebRtc_UWord8* /* payload */,
WebRtc_Word32* /* payload_length */) {}
virtual void SplitStereoPacket(uint8_t* /* payload */,
int32_t* /* payload_length */) {}
///////////////////////////////////////////////////////////////////////////
// bool EncoderInitialized();
@ -171,7 +171,7 @@ class ACMGenericCodec {
bool DecoderInitialized();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 EncoderParams()
// int16_t EncoderParams()
// It is called to get encoder parameters. It will call
// EncoderParamsSafe() in turn.
//
@ -184,10 +184,10 @@ class ACMGenericCodec {
// -1 if the encoder is not initialized,
// 0 otherwise.
//
WebRtc_Word16 EncoderParams(WebRtcACMCodecParams *enc_params);
int16_t EncoderParams(WebRtcACMCodecParams *enc_params);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 DecoderParams(...)
// int16_t DecoderParams(...)
// It is called to get decoder parameters. It will call DecoderParamsSafe()
// in turn.
//
@ -202,10 +202,10 @@ class ACMGenericCodec {
//
//
bool DecoderParams(WebRtcACMCodecParams *dec_params,
const WebRtc_UWord8 payload_type);
const uint8_t payload_type);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InitEncoder(...)
// int16_t InitEncoder(...)
// This function is called to initialize the encoder with the given
// parameters.
//
@ -220,11 +220,11 @@ class ACMGenericCodec {
// -1 if failed to initialize.
//
//
WebRtc_Word16 InitEncoder(WebRtcACMCodecParams* codec_params,
bool force_initialization);
int16_t InitEncoder(WebRtcACMCodecParams* codec_params,
bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InitDecoder()
// int16_t InitDecoder()
// This function is called to initialize the decoder with the given
// parameters. (c.f. acm_common_defs.h & common_types.h for the
// definition of the structure)
@ -240,11 +240,11 @@ class ACMGenericCodec {
// -1 if failed to initialize.
//
//
WebRtc_Word16 InitDecoder(WebRtcACMCodecParams* codec_params,
bool force_initialization);
int16_t InitDecoder(WebRtcACMCodecParams* codec_params,
bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterInNetEq(...)
// int32_t RegisterInNetEq(...)
// This function is called to register the decoder in NetEq, with the given
// payload type.
//
@ -256,10 +256,10 @@ class ACMGenericCodec {
// -1 if failed to register,
// 0 if successfully initialized.
//
WebRtc_Word32 RegisterInNetEq(ACMNetEQ* neteq, const CodecInst& codec_inst);
int32_t RegisterInNetEq(ACMNetEQ* neteq, const CodecInst& codec_inst);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 Add10MsData(...)
// int32_t Add10MsData(...)
// This function is called to add 10 ms of audio to the audio buffer of
// the codec.
//
@ -277,13 +277,13 @@ class ACMGenericCodec {
// -1 if failed
// 0 otherwise.
//
WebRtc_Word32 Add10MsData(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length,
const WebRtc_UWord8 audio_channel);
int32_t Add10MsData(const uint32_t timestamp,
const int16_t* data,
const uint16_t length,
const uint8_t audio_channel);
///////////////////////////////////////////////////////////////////////////
// WebRtc_UWord32 NoMissedSamples()
// uint32_t NoMissedSamples()
// This function returns the number of samples which are overwritten in
// the audio buffer. The audio samples are overwritten if the input audio
// buffer is full, but Add10MsData() is called. (We might remove this
@ -292,7 +292,7 @@ class ACMGenericCodec {
// Return Value:
// Number of samples which are overwritten.
//
WebRtc_UWord32 NoMissedSamples() const;
uint32_t NoMissedSamples() const;
///////////////////////////////////////////////////////////////////////////
// void ResetNoMissedSamples()
@ -302,7 +302,7 @@ class ACMGenericCodec {
void ResetNoMissedSamples();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 SetBitRate()
// int16_t SetBitRate()
// The function is called to set the encoding rate.
//
// Input:
@ -313,7 +313,7 @@ class ACMGenericCodec {
// codec is not rate-adjustable.
// 0 if the rate is adjusted successfully
//
WebRtc_Word16 SetBitRate(const WebRtc_Word32 bitrate_bps);
int16_t SetBitRate(const int32_t bitrate_bps);
///////////////////////////////////////////////////////////////////////////
// DestructEncoderInst()
@ -328,7 +328,7 @@ class ACMGenericCodec {
void DestructEncoderInst(void* ptr_inst);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 AudioBuffer()
// int16_t AudioBuffer()
// This is used when synchronization of codecs is required. There are cases
// that the audio buffers of two codecs have to be synched. By calling this
// function on can get the audio buffer and other related parameters, such
@ -342,20 +342,20 @@ class ACMGenericCodec {
// -1 if fails to copy the audio buffer,
// 0 if succeeded.
//
WebRtc_Word16 AudioBuffer(WebRtcACMAudioBuff& audio_buff);
int16_t AudioBuffer(WebRtcACMAudioBuff& audio_buff);
///////////////////////////////////////////////////////////////////////////
// WebRtc_UWord32 EarliestTimestamp()
// uint32_t EarliestTimestamp()
// Returns the timestamp of the first 10 ms in audio buffer. This is used
// to identify if a synchronization of two encoders is required.
//
// Return value:
// timestamp of the first 10 ms audio in the audio buffer.
//
WebRtc_UWord32 EarliestTimestamp() const;
uint32_t EarliestTimestamp() const;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 SetAudioBuffer()
// int16_t SetAudioBuffer()
// This function is called to set the audio buffer and the associated
// parameters to a given value.
//
@ -363,10 +363,10 @@ class ACMGenericCodec {
// -1 if fails to copy the audio buffer,
// 0 if succeeded.
//
WebRtc_Word16 SetAudioBuffer(WebRtcACMAudioBuff& audio_buff);
int16_t SetAudioBuffer(WebRtcACMAudioBuff& audio_buff);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 SetVAD()
// int16_t SetVAD()
// This is called to set VAD & DTX. If the codec has internal DTX that will
// be used. If DTX is enabled and the codec does not have internal DTX,
// WebRtc-VAD will be used to decide if the frame is active. If DTX is
@ -392,12 +392,12 @@ class ACMGenericCodec {
// -1 if failed to set DTX & VAD as specified,
// 0 if succeeded.
//
WebRtc_Word16 SetVAD(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
int16_t SetVAD(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ReplaceInternalDTX()
// int32_t ReplaceInternalDTX()
// This is called to replace the codec internal DTX with WebRtc DTX.
// This is only valid for G729 where the user has possibility to replace
// AnnexB with WebRtc DTX. For other codecs this function has no effect.
@ -409,10 +409,10 @@ class ACMGenericCodec {
// -1 if failed to replace internal DTX,
// 0 if succeeded.
//
WebRtc_Word32 ReplaceInternalDTX(const bool replace_internal_dtx);
int32_t ReplaceInternalDTX(const bool replace_internal_dtx);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 IsInternalDTXReplaced()
// int32_t IsInternalDTXReplaced()
// This is called to check if the codec internal DTX is replaced by WebRtc
// DTX. This is only valid for G729 where the user has possibility to replace
// AnnexB with WebRtc DTX. For other codecs this function has no effect.
@ -424,7 +424,7 @@ class ACMGenericCodec {
// -1 if failed to check
// 0 if succeeded.
//
WebRtc_Word32 IsInternalDTXReplaced(bool* internal_dtx_replaced);
int32_t IsInternalDTXReplaced(bool* internal_dtx_replaced);
///////////////////////////////////////////////////////////////////////////
// void SetNetEqDecodeLock()
@ -450,7 +450,7 @@ class ACMGenericCodec {
}
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 GetEstimatedBandwidth()
// int32_t GetEstimatedBandwidth()
// Used to get decoder estimated bandwidth. Only iSAC will provide a value.
//
//
@ -458,10 +458,10 @@ class ACMGenericCodec {
// -1 if fails to get decoder estimated bandwidth,
// >0 estimated bandwidth in bits/sec.
//
WebRtc_Word32 GetEstimatedBandwidth();
int32_t GetEstimatedBandwidth();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 SetEstimatedBandwidth()
// int32_t SetEstimatedBandwidth()
// Used to set estiamted bandwidth sent out of band from other side. Only
// iSAC will have use for the value.
//
@ -472,10 +472,10 @@ class ACMGenericCodec {
// -1 if fails to set estimated bandwidth,
// 0 on success.
//
WebRtc_Word32 SetEstimatedBandwidth(WebRtc_Word32 estimated_bandwidth);
int32_t SetEstimatedBandwidth(int32_t estimated_bandwidth);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 GetRedPayload()
// int32_t GetRedPayload()
// Used to get codec specific RED payload (if such is implemented).
// Currently only done in iSAC.
//
@ -487,11 +487,11 @@ class ACMGenericCodec {
// -1 if fails to get codec specific RED,
// 0 if succeeded.
//
WebRtc_Word32 GetRedPayload(WebRtc_UWord8* red_payload,
WebRtc_Word16* payload_bytes);
int32_t GetRedPayload(uint8_t* red_payload,
int16_t* payload_bytes);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 ResetEncoder()
// int16_t ResetEncoder()
// By calling this function you would re-initialize the encoder with the
// current parameters. All the settings, e.g. VAD/DTX, frame-size... should
// remain unchanged. (In case of iSAC we don't want to lose BWE history.)
@ -500,10 +500,10 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 ResetEncoder();
int16_t ResetEncoder();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 ResetEncoder()
// int16_t ResetEncoder()
// By calling this function you would re-initialize the decoder with the
// current parameters.
//
@ -511,7 +511,7 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 ResetDecoder(WebRtc_Word16 payload_type);
int16_t ResetDecoder(int16_t payload_type);
///////////////////////////////////////////////////////////////////////////
// void DestructEncoder()
@ -533,22 +533,22 @@ class ACMGenericCodec {
void DestructDecoder();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 SamplesLeftToEncode()
// int16_t SamplesLeftToEncode()
// Returns the number of samples required to be able to do encoding.
//
// Return value:
// Number of samples.
//
WebRtc_Word16 SamplesLeftToEncode();
int16_t SamplesLeftToEncode();
///////////////////////////////////////////////////////////////////////////
// WebRtc_UWord32 LastEncodedTimestamp()
// uint32_t LastEncodedTimestamp()
// Returns the timestamp of the last frame it encoded.
//
// Return value:
// Timestamp.
//
WebRtc_UWord32 LastEncodedTimestamp() const;
uint32_t LastEncodedTimestamp() const;
///////////////////////////////////////////////////////////////////////////
// SetUniqueID()
@ -557,7 +557,7 @@ class ACMGenericCodec {
// Input
// -id : A number to identify the codec.
//
void SetUniqueID(const WebRtc_UWord32 id);
void SetUniqueID(const uint32_t id);
///////////////////////////////////////////////////////////////////////////
// IsAudioBufferFresh()
@ -594,7 +594,7 @@ class ACMGenericCodec {
// 0 if succeeded in updating the decoder.
// -1 if failed to update.
//
virtual WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 /* codec_id */) {
virtual int16_t UpdateDecoderSampFreq(int16_t /* codec_id */) {
return 0;
}
@ -614,8 +614,8 @@ class ACMGenericCodec {
// -1 if failed, or if this is meaningless for the given codec.
// 0 if succeeded.
//
virtual WebRtc_Word16 UpdateEncoderSampFreq(
WebRtc_UWord16 samp_freq_hz);
virtual int16_t UpdateEncoderSampFreq(
uint16_t samp_freq_hz);
///////////////////////////////////////////////////////////////////////////
// EncoderSampFreq()
@ -629,10 +629,10 @@ class ACMGenericCodec {
// -1 if failed to output sampling rate.
// 0 if the sample rate is returned successfully.
//
virtual WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& samp_freq_hz);
virtual int16_t EncoderSampFreq(uint16_t& samp_freq_hz);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 ConfigISACBandwidthEstimator()
// int32_t ConfigISACBandwidthEstimator()
// Call this function to configure the bandwidth estimator of ISAC.
// During the adaptation of bit-rate, iSAC automatically adjusts the
// frame-size (either 30 or 60 ms) to save on RTP header. The initial
@ -655,9 +655,9 @@ class ACMGenericCodec {
// -1 if failed to configure the bandwidth estimator,
// 0 if the configuration was successfully applied.
//
virtual WebRtc_Word32 ConfigISACBandwidthEstimator(
const WebRtc_UWord8 init_frame_size_msec,
const WebRtc_UWord16 init_rate_bps,
virtual int32_t ConfigISACBandwidthEstimator(
const uint8_t init_frame_size_msec,
const uint16_t init_rate_bps,
const bool enforce_frame_size);
///////////////////////////////////////////////////////////////////////////
@ -675,8 +675,8 @@ class ACMGenericCodec {
// -1 if failed to set the maximum payload-size.
// 0 if the given length is set successfully.
//
virtual WebRtc_Word32 SetISACMaxPayloadSize(
const WebRtc_UWord16 max_payload_len_bytes);
virtual int32_t SetISACMaxPayloadSize(
const uint16_t max_payload_len_bytes);
///////////////////////////////////////////////////////////////////////////
// SetISACMaxRate()
@ -693,7 +693,7 @@ class ACMGenericCodec {
// -1 if failed to set the maximum rate.
// 0 if the maximum rate is set successfully.
//
virtual WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_rate_bps);
virtual int32_t SetISACMaxRate(const uint32_t max_rate_bps);
///////////////////////////////////////////////////////////////////////////
// SaveDecoderParamS()
@ -705,7 +705,7 @@ class ACMGenericCodec {
//
void SaveDecoderParam(const WebRtcACMCodecParams* codec_params);
WebRtc_Word32 FrameSize() {
int32_t FrameSize() {
return frame_len_smpl_;
}
@ -734,10 +734,10 @@ class ACMGenericCodec {
// -1 if an error occurs, otherwise the length of the payload (in Bytes)
// is returned.
//
virtual WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isac_rate,
const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
WebRtc_Word16* payload_len_bytes);
virtual int16_t REDPayloadISAC(const int32_t isac_rate,
const int16_t isac_bw_estimate,
uint8_t* payload,
int16_t* payload_len_bytes);
///////////////////////////////////////////////////////////////////////////
// IsTrueStereoCodec()
@ -771,33 +771,33 @@ class ACMGenericCodec {
// See Decode() for the description of function, input(s)/output(s) and
// return value.
//
virtual WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type) = 0;
virtual int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type) = 0;
///////////////////////////////////////////////////////////////////////////
// See Add10MsSafe() for the description of function, input(s)/output(s)
// and return value.
//
virtual WebRtc_Word32 Add10MsDataSafe(const WebRtc_UWord32 timestamp,
const WebRtc_Word16* data,
const WebRtc_UWord16 length,
const WebRtc_UWord8 audio_channel);
virtual int32_t Add10MsDataSafe(const uint32_t timestamp,
const int16_t* data,
const uint16_t length,
const uint8_t audio_channel);
///////////////////////////////////////////////////////////////////////////
// See RegisterInNetEq() for the description of function,
// input(s)/output(s) and return value.
//
virtual WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) = 0;
virtual int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) = 0;
///////////////////////////////////////////////////////////////////////////
// See EncoderParam() for the description of function, input(s)/output(s)
// and return value.
//
WebRtc_Word16 EncoderParamsSafe(WebRtcACMCodecParams *enc_params);
int16_t EncoderParamsSafe(WebRtcACMCodecParams *enc_params);
///////////////////////////////////////////////////////////////////////////
// See DecoderParam for the description of function, input(s)/output(s)
@ -814,33 +814,33 @@ class ACMGenericCodec {
// with a single codec instance.
//
virtual bool DecoderParamsSafe(WebRtcACMCodecParams *dec_params,
const WebRtc_UWord8 payload_type);
const uint8_t payload_type);
///////////////////////////////////////////////////////////////////////////
// See ResetEncoder() for the description of function, input(s)/output(s)
// and return value.
//
WebRtc_Word16 ResetEncoderSafe();
int16_t ResetEncoderSafe();
///////////////////////////////////////////////////////////////////////////
// See InitEncoder() for the description of function, input(s)/output(s)
// and return value.
//
WebRtc_Word16 InitEncoderSafe(WebRtcACMCodecParams *codec_params,
bool force_initialization);
int16_t InitEncoderSafe(WebRtcACMCodecParams *codec_params,
bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// See InitDecoder() for the description of function, input(s)/output(s)
// and return value.
//
WebRtc_Word16 InitDecoderSafe(WebRtcACMCodecParams *codec_params,
bool force_initialization);
int16_t InitDecoderSafe(WebRtcACMCodecParams *codec_params,
bool force_initialization);
///////////////////////////////////////////////////////////////////////////
// See ResetDecoder() for the description of function, input(s)/output(s)
// and return value.
//
WebRtc_Word16 ResetDecoderSafe(WebRtc_Word16 payload_type);
int16_t ResetDecoderSafe(int16_t payload_type);
///////////////////////////////////////////////////////////////////////////
// See DestructEncoder() for the description of function,
@ -860,70 +860,70 @@ class ACMGenericCodec {
//
// Any codec that can change the bit-rate has to implement this.
//
virtual WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bitrate_bps);
virtual int16_t SetBitRateSafe(const int32_t bitrate_bps);
///////////////////////////////////////////////////////////////////////////
// See GetEstimatedBandwidth() for the description of function,
// input(s)/output(s) and return value.
//
virtual WebRtc_Word32 GetEstimatedBandwidthSafe();
virtual int32_t GetEstimatedBandwidthSafe();
///////////////////////////////////////////////////////////////////////////
// See SetEstimatedBandwidth() for the description of function,
// input(s)/output(s) and return value.
//
virtual WebRtc_Word32 SetEstimatedBandwidthSafe(
WebRtc_Word32 estimated_bandwidth);
virtual int32_t SetEstimatedBandwidthSafe(
int32_t estimated_bandwidth);
///////////////////////////////////////////////////////////////////////////
// See GetRedPayload() for the description of function, input(s)/output(s)
// and return value.
//
virtual WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* red_payload,
WebRtc_Word16* payload_bytes);
virtual int32_t GetRedPayloadSafe(uint8_t* red_payload,
int16_t* payload_bytes);
///////////////////////////////////////////////////////////////////////////
// See SetVAD() for the description of function, input(s)/output(s) and
// return value.
//
WebRtc_Word16 SetVADSafe(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
int16_t SetVADSafe(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
///////////////////////////////////////////////////////////////////////////
// See ReplaceInternalDTX() for the description of function, input and
// return value.
//
virtual WebRtc_Word32 ReplaceInternalDTXSafe(const bool replace_internal_dtx);
virtual int32_t ReplaceInternalDTXSafe(const bool replace_internal_dtx);
///////////////////////////////////////////////////////////////////////////
// See IsInternalDTXReplaced() for the description of function, input and
// return value.
//
virtual WebRtc_Word32 IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
virtual int32_t IsInternalDTXReplacedSafe(bool* internal_dtx_replaced);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 CreateEncoder()
// int16_t CreateEncoder()
// Creates the encoder instance.
//
// Return value:
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 CreateEncoder();
int16_t CreateEncoder();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 CreateDecoder()
// int16_t CreateDecoder()
// Creates the decoder instance.
//
// Return value:
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 CreateDecoder();
int16_t CreateDecoder();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 EnableVAD();
// int16_t EnableVAD();
// Enables VAD with the given mode. The VAD instance will be created if
// it does not exists.
//
@ -935,20 +935,20 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 EnableVAD(ACMVADMode mode);
int16_t EnableVAD(ACMVADMode mode);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 DisableVAD()
// int16_t DisableVAD()
// Disables VAD.
//
// Return value:
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 DisableVAD();
int16_t DisableVAD();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 EnableDTX()
// int16_t EnableDTX()
// Enables DTX. This method should be overwritten for codecs which have
// internal DTX.
//
@ -956,10 +956,10 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 EnableDTX();
virtual int16_t EnableDTX();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 DisableDTX()
// int16_t DisableDTX()
// Disables usage of DTX. This method should be overwritten for codecs which
// have internal DTX.
//
@ -967,10 +967,10 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 DisableDTX();
virtual int16_t DisableDTX();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalEncode()
// int16_t InternalEncode()
// This is a codec-specific function called in EncodeSafe() to actually
// encode a frame of audio.
//
@ -984,11 +984,11 @@ class ACMGenericCodec {
// -1 if failed,
// otherwise the length of the bit-stream is returned.
//
virtual WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) = 0;
virtual int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalInitEncoder()
// int16_t InternalInitEncoder()
// This is a codec-specific function called in InitEncoderSafe(), it has to
// do all codec-specific operation to initialize the encoder given the
// encoder parameters.
@ -1006,11 +1006,11 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalInitEncoder(
virtual int16_t InternalInitEncoder(
WebRtcACMCodecParams *codec_params) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalInitDecoder()
// int16_t InternalInitDecoder()
// This is a codec-specific function called in InitDecoderSafe(), it has to
// do all codec-specific operation to initialize the decoder given the
// decoder parameters.
@ -1023,7 +1023,7 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalInitDecoder(
virtual int16_t InternalInitDecoder(
WebRtcACMCodecParams *codec_params) = 0;
///////////////////////////////////////////////////////////////////////////
@ -1035,10 +1035,10 @@ class ACMGenericCodec {
// -num_samples : the number of overwritten samples is incremented
// by this value.
//
void IncreaseNoMissedSamples(const WebRtc_Word16 num_samples);
void IncreaseNoMissedSamples(const int16_t num_samples);
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalCreateEncoder()
// int16_t InternalCreateEncoder()
// This is a codec-specific method called in CreateEncoderSafe() it is
// supposed to perform all codec-specific operations to create encoder
// instance.
@ -1047,10 +1047,10 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalCreateEncoder() = 0;
virtual int16_t InternalCreateEncoder() = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalCreateDecoder()
// int16_t InternalCreateDecoder()
// This is a codec-specific method called in CreateDecoderSafe() it is
// supposed to perform all codec-specific operations to create decoder
// instance.
@ -1059,7 +1059,7 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalCreateDecoder() = 0;
virtual int16_t InternalCreateDecoder() = 0;
///////////////////////////////////////////////////////////////////////////
// void InternalDestructEncoderInst()
@ -1079,7 +1079,7 @@ class ACMGenericCodec {
virtual void InternalDestructEncoderInst(void* ptr_inst) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 InternalResetEncoder()
// int16_t InternalResetEncoder()
// This method is called to reset the states of encoder. However, the
// current parameters, e.g. frame-length, should remain as they are. For
// most of the codecs a re-initialization of the encoder is what needs to
@ -1091,10 +1091,10 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
virtual WebRtc_Word16 InternalResetEncoder();
virtual int16_t InternalResetEncoder();
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word16 ProcessFrameVADDTX()
// int16_t ProcessFrameVADDTX()
// This function is called when a full frame of audio is available. It will
// break the audio frame into blocks such that each block could be processed
// by VAD & CN/DTX. If a frame is divided into two blocks then there are two
@ -1123,9 +1123,9 @@ class ACMGenericCodec {
// -1 if failed,
// 0 if succeeded.
//
WebRtc_Word16 ProcessFrameVADDTX(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte,
WebRtc_Word16* samples_processed);
int16_t ProcessFrameVADDTX(uint8_t* bitstream,
int16_t* bitstream_len_byte,
int16_t* samples_processed);
///////////////////////////////////////////////////////////////////////////
// CanChangeEncodingParam()
@ -1148,7 +1148,7 @@ class ACMGenericCodec {
// Output:
// -rate_bps : the current target rate of the codec.
//
virtual void CurrentRate(WebRtc_Word32& /* rate_bps */) {
virtual void CurrentRate(int32_t& /* rate_bps */) {
return;
}
@ -1156,30 +1156,30 @@ class ACMGenericCodec {
// &in_audio_[in_audio_ix_write_] always point to where new audio can be
// written to
WebRtc_Word16 in_audio_ix_write_;
int16_t in_audio_ix_write_;
// &in_audio_[in_audio_ix_read_] points to where audio has to be read from
WebRtc_Word16 in_audio_ix_read_;
int16_t in_audio_ix_read_;
WebRtc_Word16 in_timestamp_ix_write_;
int16_t in_timestamp_ix_write_;
// Where the audio is stored before encoding,
// To save memory the following buffer can be allocated
// dynamically for 80 ms depending on the sampling frequency
// of the codec.
WebRtc_Word16* in_audio_;
WebRtc_UWord32* in_timestamp_;
int16_t* in_audio_;
uint32_t* in_timestamp_;
WebRtc_Word16 frame_len_smpl_;
WebRtc_UWord16 num_channels_;
int16_t frame_len_smpl_;
uint16_t num_channels_;
// This will point to a static database of the supported codecs
WebRtc_Word16 codec_id_;
int16_t codec_id_;
// This will account for the number of samples were not encoded
// the case is rare, either samples are missed due to overwrite
// at input buffer or due to encoding error
WebRtc_UWord32 num_missed_samples_;
uint32_t num_missed_samples_;
// True if the encoder instance created
bool encoder_exist_;
@ -1195,10 +1195,10 @@ class ACMGenericCodec {
WebRtcVadInst* ptr_vad_inst_;
bool vad_enabled_;
ACMVADMode vad_mode_;
WebRtc_Word16 vad_label_[MAX_FRAME_SIZE_10MSEC];
int16_t vad_label_[MAX_FRAME_SIZE_10MSEC];
bool dtx_enabled_;
WebRtcCngEncInst* ptr_dtx_inst_;
WebRtc_UWord8 num_lpc_params_;
uint8_t num_lpc_params_;
bool sent_cn_previous_;
bool is_master_;
int16_t prev_frame_cng_;
@ -1213,10 +1213,10 @@ class ACMGenericCodec {
// such as buffers and state variables.
RWLockWrapper& codec_wrapper_lock_;
WebRtc_UWord32 last_encoded_timestamp_;
WebRtc_UWord32 last_timestamp_;
uint32_t last_encoded_timestamp_;
uint32_t last_timestamp_;
bool is_audio_buff_fresh_;
WebRtc_UWord32 unique_id_;
uint32_t unique_id_;
};
} // namespace webrt

View File

@ -26,7 +26,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_GSMFR
ACMGSMFR::ACMGSMFR(WebRtc_Word16 /* codec_id */)
ACMGSMFR::ACMGSMFR(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
return;
@ -36,40 +36,40 @@ ACMGSMFR::~ACMGSMFR() {
return;
}
WebRtc_Word16 ACMGSMFR::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMGSMFR::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMGSMFR::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMGSMFR::EnableDTX() {
int16_t ACMGSMFR::EnableDTX() {
return -1;
}
WebRtc_Word16 ACMGSMFR::DisableDTX() {
int16_t ACMGSMFR::DisableDTX() {
return -1;
}
WebRtc_Word16 ACMGSMFR::InternalInitEncoder(
int16_t ACMGSMFR::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMGSMFR::InternalInitDecoder(
int16_t ACMGSMFR::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -77,7 +77,7 @@ ACMGenericCodec* ACMGSMFR::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMGSMFR::InternalCreateEncoder() {
int16_t ACMGSMFR::InternalCreateEncoder() {
return -1;
}
@ -85,7 +85,7 @@ void ACMGSMFR::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMGSMFR::InternalCreateDecoder() {
int16_t ACMGSMFR::InternalCreateDecoder() {
return -1;
}
@ -99,7 +99,7 @@ void ACMGSMFR::InternalDestructEncoderInst(void* /* ptr_inst */) {
#else //===================== Actual Implementation =======================
ACMGSMFR::ACMGSMFR(WebRtc_Word16 codec_id)
ACMGSMFR::ACMGSMFR(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
codec_id_ = codec_id;
@ -119,27 +119,27 @@ ACMGSMFR::~ACMGSMFR() {
return;
}
WebRtc_Word16 ACMGSMFR::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMGSMFR::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
*bitstream_len_byte = WebRtcGSMFR_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
frame_len_smpl_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
in_audio_ix_read_ += frame_len_smpl_;
return *bitstream_len_byte;
}
WebRtc_Word16 ACMGSMFR::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMGSMFR::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMGSMFR::EnableDTX() {
int16_t ACMGSMFR::EnableDTX() {
if (dtx_enabled_) {
return 0;
} else if (encoder_exist_) {
@ -155,7 +155,7 @@ WebRtc_Word16 ACMGSMFR::EnableDTX() {
}
}
WebRtc_Word16 ACMGSMFR::DisableDTX() {
int16_t ACMGSMFR::DisableDTX() {
if (!dtx_enabled_) {
return 0;
} else if (encoder_exist_) {
@ -172,7 +172,7 @@ WebRtc_Word16 ACMGSMFR::DisableDTX() {
}
}
WebRtc_Word16 ACMGSMFR::InternalInitEncoder(
int16_t ACMGSMFR::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
if (WebRtcGSMFR_EncoderInit(encoder_inst_ptr_,
((codec_params->enable_dtx) ? 1 : 0)) < 0) {
@ -182,7 +182,7 @@ WebRtc_Word16 ACMGSMFR::InternalInitEncoder(
return 0;
}
WebRtc_Word16 ACMGSMFR::InternalInitDecoder(
int16_t ACMGSMFR::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
if (WebRtcGSMFR_DecoderInit(decoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
@ -192,8 +192,8 @@ WebRtc_Word16 ACMGSMFR::InternalInitDecoder(
return 0;
}
WebRtc_Word32 ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMGSMFR::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodecDef: decoder is not initialized for GSMFR");
@ -213,7 +213,7 @@ ACMGenericCodec* ACMGSMFR::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMGSMFR::InternalCreateEncoder() {
int16_t ACMGSMFR::InternalCreateEncoder() {
if (WebRtcGSMFR_CreateEnc(&encoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: cannot create instance for GSMFR "
@ -232,7 +232,7 @@ void ACMGSMFR::DestructEncoderSafe() {
encoder_initialized_ = false;
}
WebRtc_Word16 ACMGSMFR::InternalCreateDecoder() {
int16_t ACMGSMFR::InternalCreateDecoder() {
if (WebRtcGSMFR_CreateDec(&decoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: cannot create instance for GSMFR "

View File

@ -21,42 +21,42 @@ namespace webrtc {
class ACMGSMFR : public ACMGenericCodec {
public:
explicit ACMGSMFR(WebRtc_Word16 codec_id);
explicit ACMGSMFR(int16_t codec_id);
~ACMGSMFR();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 EnableDTX();
int16_t EnableDTX();
WebRtc_Word16 DisableDTX();
int16_t DisableDTX();
GSMFR_encinst_t_* encoder_inst_ptr_;
GSMFR_decinst_t_* decoder_inst_ptr_;

View File

@ -23,7 +23,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_ILBC
ACMILBC::ACMILBC(WebRtc_Word16 /* codec_id */)
ACMILBC::ACMILBC(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
return;
@ -33,32 +33,32 @@ ACMILBC::~ACMILBC() {
return;
}
WebRtc_Word16 ACMILBC::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMILBC::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMILBC::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMILBC::InternalInitEncoder(
int16_t ACMILBC::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMILBC::InternalInitDecoder(
int16_t ACMILBC::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -66,7 +66,7 @@ ACMGenericCodec* ACMILBC::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMILBC::InternalCreateEncoder() {
int16_t ACMILBC::InternalCreateEncoder() {
return -1;
}
@ -74,7 +74,7 @@ void ACMILBC::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMILBC::InternalCreateDecoder() {
int16_t ACMILBC::InternalCreateDecoder() {
return -1;
}
@ -86,13 +86,13 @@ void ACMILBC::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMILBC::SetBitRateSafe(const WebRtc_Word32 /* rate */) {
int16_t ACMILBC::SetBitRateSafe(const int32_t /* rate */) {
return -1;
}
#else //===================== Actual Implementation =======================
ACMILBC::ACMILBC(WebRtc_Word16 codec_id)
ACMILBC::ACMILBC(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
codec_id_ = codec_id;
@ -111,12 +111,12 @@ ACMILBC::~ACMILBC() {
return;
}
WebRtc_Word16 ACMILBC::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMILBC::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
*bitstream_len_byte = WebRtcIlbcfix_Encode(encoder_inst_ptr_,
&in_audio_[in_audio_ix_read_],
frame_len_smpl_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
if (*bitstream_len_byte < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalEncode: error in encode for ILBC");
@ -128,15 +128,15 @@ WebRtc_Word16 ACMILBC::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMILBC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMILBC::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMILBC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMILBC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// initialize with a correct processing block length
if ((160 == (codec_params->codec_inst).pacsize) ||
(320 == (codec_params->codec_inst).pacsize)) {
@ -153,7 +153,7 @@ WebRtc_Word16 ACMILBC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
}
}
WebRtc_Word16 ACMILBC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMILBC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
// initialize with a correct processing block length
if ((160 == (codec_params->codec_inst).pacsize) ||
(320 == (codec_params->codec_inst).pacsize)) {
@ -170,8 +170,8 @@ WebRtc_Word16 ACMILBC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
}
}
WebRtc_Word32 ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMILBC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"CodeDef: decoder not initialized for ILBC");
@ -191,7 +191,7 @@ ACMGenericCodec* ACMILBC::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMILBC::InternalCreateEncoder() {
int16_t ACMILBC::InternalCreateEncoder() {
if (WebRtcIlbcfix_EncoderCreate(&encoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateEncoder: cannot create instance for ILBC "
@ -210,7 +210,7 @@ void ACMILBC::DestructEncoderSafe() {
}
}
WebRtc_Word16 ACMILBC::InternalCreateDecoder() {
int16_t ACMILBC::InternalCreateDecoder() {
if (WebRtcIlbcfix_DecoderCreate(&decoder_inst_ptr_) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"InternalCreateDecoder: cannot create instance for ILBC "
@ -236,7 +236,7 @@ void ACMILBC::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
WebRtc_Word16 ACMILBC::SetBitRateSafe(const WebRtc_Word32 rate) {
int16_t ACMILBC::SetBitRateSafe(const int32_t rate) {
// Check that rate is valid. No need to store the value
if (rate == 13300) {
WebRtcIlbcfix_EncoderInit(encoder_inst_ptr_, 30);

View File

@ -21,38 +21,38 @@ namespace webrtc {
class ACMILBC : public ACMGenericCodec {
public:
explicit ACMILBC(WebRtc_Word16 codec_id);
explicit ACMILBC(int16_t codec_id);
~ACMILBC();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
int16_t SetBitRateSafe(const int32_t rate);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);

View File

@ -41,14 +41,14 @@ struct ACMISACInst {
// Tables for bandwidth estimates
#define NR_ISAC_BANDWIDTHS 24
static const WebRtc_Word32 kIsacRatesWb[NR_ISAC_BANDWIDTHS] = {
static const int32_t kIsacRatesWb[NR_ISAC_BANDWIDTHS] = {
10000, 11100, 12300, 13700, 15200, 16900,
18800, 20900, 23300, 25900, 28700, 31900,
10100, 11200, 12400, 13800, 15300, 17000,
18900, 21000, 23400, 26000, 28800, 32000
};
static const WebRtc_Word32 kIsacRatesSwb[NR_ISAC_BANDWIDTHS] = {
static const int32_t kIsacRatesSwb[NR_ISAC_BANDWIDTHS] = {
10000, 11000, 12400, 13800, 15300, 17000,
18900, 21000, 23200, 25400, 27600, 29800,
32000, 34100, 36300, 38500, 40700, 42900,
@ -57,7 +57,7 @@ static const WebRtc_Word32 kIsacRatesSwb[NR_ISAC_BANDWIDTHS] = {
#if (!defined(WEBRTC_CODEC_ISAC) && !defined(WEBRTC_CODEC_ISACFX))
ACMISAC::ACMISAC(WebRtc_Word16 /* codec_id */)
ACMISAC::ACMISAC(int16_t /* codec_id */)
: codec_inst_ptr_(NULL),
is_enc_initialized_(false),
isac_coding_mode_(CHANNEL_INDEPENDENT),
@ -79,31 +79,31 @@ ACMGenericCodec* ACMISAC::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMISAC::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMISAC::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMISAC::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMISAC::InternalInitEncoder(
int16_t ACMISAC::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMISAC::InternalInitDecoder(
int16_t ACMISAC::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMISAC::InternalCreateDecoder() {
int16_t ACMISAC::InternalCreateDecoder() {
return -1;
}
@ -111,7 +111,7 @@ void ACMISAC::DestructDecoderSafe() {
return;
}
WebRtc_Word16 ACMISAC::InternalCreateEncoder() {
int16_t ACMISAC::InternalCreateEncoder() {
return -1;
}
@ -119,8 +119,8 @@ void ACMISAC::DestructEncoderSafe() {
return;
}
WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -128,69 +128,69 @@ void ACMISAC::InternalDestructEncoderInst(void* /* ptr_inst */) {
return;
}
WebRtc_Word16 ACMISAC::DeliverCachedIsacData(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */,
WebRtc_UWord32* /* timestamp */,
int16_t ACMISAC::DeliverCachedIsacData(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */,
uint32_t* /* timestamp */,
WebRtcACMEncodingType* /* encoding_type */,
const WebRtc_UWord16 /* isac_rate */,
const WebRtc_UWord8 /* isac_bw_estimate */) {
const uint16_t /* isac_rate */,
const uint8_t /* isac_bw_estimate */) {
return -1;
}
WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */,
WebRtc_Word16 /* q_bwe */,
WebRtc_Word32 /* scale */,
bool /* is_red */) {
int16_t ACMISAC::Transcode(uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */,
int16_t /* q_bwe */,
int32_t /* scale */,
bool /* is_red */) {
return -1;
}
WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 /* bit_rate */) {
int16_t ACMISAC::SetBitRateSafe(int32_t /* bit_rate */) {
return -1;
}
WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
int32_t ACMISAC::GetEstimatedBandwidthSafe() {
return -1;
}
WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
WebRtc_Word32 /* estimated_bandwidth */) {
int32_t ACMISAC::SetEstimatedBandwidthSafe(
int32_t /* estimated_bandwidth */) {
return -1;
}
WebRtc_Word32 ACMISAC::GetRedPayloadSafe(WebRtc_UWord8* /* red_payload */,
WebRtc_Word16* /* payload_bytes */) {
int32_t ACMISAC::GetRedPayloadSafe(uint8_t* /* red_payload */,
int16_t* /* payload_bytes */) {
return -1;
}
WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(WebRtc_Word16 /* codec_id */) {
int16_t ACMISAC::UpdateDecoderSampFreq(int16_t /* codec_id */) {
return -1;
}
WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
WebRtc_UWord16 /* encoder_samp_freq_hz */) {
int16_t ACMISAC::UpdateEncoderSampFreq(
uint16_t /* encoder_samp_freq_hz */) {
return -1;
}
WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& /* samp_freq_hz */) {
int16_t ACMISAC::EncoderSampFreq(uint16_t& /* samp_freq_hz */) {
return -1;
}
WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
const WebRtc_UWord8 /* init_frame_size_msec */,
const WebRtc_UWord16 /* init_rate_bit_per_sec */,
int32_t ACMISAC::ConfigISACBandwidthEstimator(
const uint8_t /* init_frame_size_msec */,
const uint16_t /* init_rate_bit_per_sec */,
const bool /* enforce_frame_size */) {
return -1;
}
WebRtc_Word32 ACMISAC::SetISACMaxPayloadSize(
const WebRtc_UWord16 /* max_payload_len_bytes */) {
int32_t ACMISAC::SetISACMaxPayloadSize(
const uint16_t /* max_payload_len_bytes */) {
return -1;
}
WebRtc_Word32 ACMISAC::SetISACMaxRate(
const WebRtc_UWord32 /* max_rate_bit_per_sec */) {
int32_t ACMISAC::SetISACMaxRate(
const uint32_t /* max_rate_bit_per_sec */) {
return -1;
}
@ -198,14 +198,14 @@ void ACMISAC::UpdateFrameLen() {
return;
}
void ACMISAC::CurrentRate(WebRtc_Word32& /*rate_bit_per_sec */) {
void ACMISAC::CurrentRate(int32_t& /*rate_bit_per_sec */) {
return;
}
bool
ACMISAC::DecoderParamsSafe(
WebRtcACMCodecParams* /* dec_params */,
const WebRtc_UWord8 /* payload_type */) {
const uint8_t /* payload_type */) {
return false;
}
@ -215,11 +215,11 @@ ACMISAC::SaveDecoderParamSafe(
return;
}
WebRtc_Word16 ACMISAC::REDPayloadISAC(
const WebRtc_Word32 /* isac_rate */,
const WebRtc_Word16 /* isac_bw_estimate */,
WebRtc_UWord8* /* payload */,
WebRtc_Word16* /* payload_len_bytes */) {
int16_t ACMISAC::REDPayloadISAC(
const int32_t /* isac_rate */,
const int16_t /* isac_bw_estimate */,
uint8_t* /* payload */,
int16_t* /* payload_len_bytes */) {
return -1;
}
@ -243,7 +243,7 @@ WebRtc_Word16 ACMISAC::REDPayloadISAC(
#define ISAC_NUM_SUPPORTED_RATES 9
static const WebRtc_UWord16 kIsacSuportedRates[ISAC_NUM_SUPPORTED_RATES] = {
static const uint16_t kIsacSuportedRates[ISAC_NUM_SUPPORTED_RATES] = {
32000, 30000, 26000, 23000, 21000,
19000, 17000, 15000, 12000
};
@ -258,11 +258,11 @@ enum IsacSamplingRate {
kIsacSuperWideband = 32
};
static float ACMISACFixTranscodingScale(WebRtc_UWord16 rate) {
static float ACMISACFixTranscodingScale(uint16_t rate) {
// find the scale for transcoding, the scale is rounded
// downward
float scale = -1;
for (WebRtc_Word16 n = 0; n < ISAC_NUM_SUPPORTED_RATES; n++) {
for (int16_t n = 0; n < ISAC_NUM_SUPPORTED_RATES; n++) {
if (rate >= kIsacSuportedRates[n]) {
scale = kIsacScale[n];
break;
@ -272,29 +272,29 @@ static float ACMISACFixTranscodingScale(WebRtc_UWord16 rate) {
}
static void ACMISACFixGetSendBitrate(ACM_ISAC_STRUCT* inst,
WebRtc_Word32* bottleneck) {
int32_t* bottleneck) {
*bottleneck = WebRtcIsacfix_GetUplinkBw(inst);
}
static WebRtc_Word16 ACMISACFixGetNewBitstream(ACM_ISAC_STRUCT* inst,
WebRtc_Word16 bwe_index,
WebRtc_Word16 /* jitter_index */,
WebRtc_Word32 rate,
WebRtc_Word16* bitstream,
static int16_t ACMISACFixGetNewBitstream(ACM_ISAC_STRUCT* inst,
int16_t bwe_index,
int16_t /* jitter_index */,
int32_t rate,
int16_t* bitstream,
bool is_red) {
if (is_red) {
// RED not supported with iSACFIX
return -1;
}
float scale = ACMISACFixTranscodingScale((WebRtc_UWord16) rate);
float scale = ACMISACFixTranscodingScale((uint16_t) rate);
return WebRtcIsacfix_GetNewBitStream(inst, bwe_index, scale, bitstream);
}
static WebRtc_Word16 ACMISACFixGetSendBWE(ACM_ISAC_STRUCT* inst,
WebRtc_Word16* rate_index,
WebRtc_Word16* /* dummy */) {
WebRtc_Word16 local_rate_index;
WebRtc_Word16 status = WebRtcIsacfix_GetDownLinkBwIndex(inst,
static int16_t ACMISACFixGetSendBWE(ACM_ISAC_STRUCT* inst,
int16_t* rate_index,
int16_t* /* dummy */) {
int16_t local_rate_index;
int16_t status = WebRtcIsacfix_GetDownLinkBwIndex(inst,
&local_rate_index);
if (status < 0) {
return -1;
@ -304,34 +304,34 @@ static WebRtc_Word16 ACMISACFixGetSendBWE(ACM_ISAC_STRUCT* inst,
}
}
static WebRtc_Word16 ACMISACFixControlBWE(ACM_ISAC_STRUCT* inst,
WebRtc_Word32 rate_bps,
WebRtc_Word16 frame_size_ms,
WebRtc_Word16 enforce_frame_size) {
return WebRtcIsacfix_ControlBwe(inst, (WebRtc_Word16) rate_bps, frame_size_ms,
static int16_t ACMISACFixControlBWE(ACM_ISAC_STRUCT* inst,
int32_t rate_bps,
int16_t frame_size_ms,
int16_t enforce_frame_size) {
return WebRtcIsacfix_ControlBwe(inst, (int16_t) rate_bps, frame_size_ms,
enforce_frame_size);
}
static WebRtc_Word16 ACMISACFixControl(ACM_ISAC_STRUCT* inst,
WebRtc_Word32 rate_bps,
WebRtc_Word16 frame_size_ms) {
return WebRtcIsacfix_Control(inst, (WebRtc_Word16) rate_bps, frame_size_ms);
static int16_t ACMISACFixControl(ACM_ISAC_STRUCT* inst,
int32_t rate_bps,
int16_t frame_size_ms) {
return WebRtcIsacfix_Control(inst, (int16_t) rate_bps, frame_size_ms);
}
// The following two function should have the same signature as their counter
// part in iSAC floating-point, i.e. WebRtcIsac_EncSampRate &
// WebRtcIsac_DecSampRate.
static WebRtc_UWord16 ACMISACFixGetEncSampRate(ACM_ISAC_STRUCT* /* inst */) {
static uint16_t ACMISACFixGetEncSampRate(ACM_ISAC_STRUCT* /* inst */) {
return 16000;
}
static WebRtc_UWord16 ACMISACFixGetDecSampRate(ACM_ISAC_STRUCT* /* inst */) {
static uint16_t ACMISACFixGetDecSampRate(ACM_ISAC_STRUCT* /* inst */) {
return 16000;
}
#endif
ACMISAC::ACMISAC(WebRtc_Word16 codec_id)
ACMISAC::ACMISAC(int16_t codec_id)
: is_enc_initialized_(false),
isac_coding_mode_(CHANNEL_INDEPENDENT),
enforce_frame_size_(false),
@ -372,8 +372,8 @@ ACMGenericCodec* ACMISAC::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMISAC::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMISAC::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
// ISAC takes 10ms audio everytime we call encoder, therefor,
// it should be treated like codecs with 'basic coding block'
// non-zero, and the following 'while-loop' should not be necessary.
@ -396,7 +396,7 @@ WebRtc_Word16 ACMISAC::InternalEncode(WebRtc_UWord8* bitstream,
}
*bitstream_len_byte = ACM_ISAC_ENCODE(codec_inst_ptr_->inst,
&in_audio_[in_audio_ix_read_],
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
// increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer
in_audio_ix_read_ += samples_in_10ms_audio_;
@ -417,15 +417,15 @@ WebRtc_Word16 ACMISAC::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMISAC::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_sample */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMISAC::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_sample */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
// if rate is set to -1 then iSAC has to be in adaptive mode
if (codec_params->codec_inst.rate == -1) {
isac_coding_mode_ = ADAPTIVE;
@ -439,7 +439,7 @@ WebRtc_Word16 ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
}
// we need to set the encoder sampling frequency.
if (UpdateEncoderSampFreq((WebRtc_UWord16) codec_params->codec_inst.plfreq)
if (UpdateEncoderSampFreq((uint16_t) codec_params->codec_inst.plfreq)
< 0) {
return -1;
}
@ -465,7 +465,7 @@ WebRtc_Word16 ACMISAC::InternalInitEncoder(WebRtcACMCodecParams* codec_params) {
return 0;
}
WebRtc_Word16 ACMISAC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
int16_t ACMISAC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
if (codec_inst_ptr_ == NULL) {
return -1;
}
@ -496,11 +496,11 @@ WebRtc_Word16 ACMISAC::InternalInitDecoder(WebRtcACMCodecParams* codec_params) {
return ACM_ISAC_DECODERINIT(codec_inst_ptr_->inst);
}
WebRtc_Word16 ACMISAC::InternalCreateDecoder() {
int16_t ACMISAC::InternalCreateDecoder() {
if (codec_inst_ptr_ == NULL) {
return -1;
}
WebRtc_Word16 status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
int16_t status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
// specific to codecs with one instance for encoding and decoding
encoder_initialized_ = false;
@ -518,11 +518,11 @@ void ACMISAC::DestructDecoderSafe() {
return;
}
WebRtc_Word16 ACMISAC::InternalCreateEncoder() {
int16_t ACMISAC::InternalCreateEncoder() {
if (codec_inst_ptr_ == NULL) {
return -1;
}
WebRtc_Word16 status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
int16_t status = ACM_ISAC_CREATE(&(codec_inst_ptr_->inst));
// specific to codecs with one instance for encoding and decoding
decoder_initialized_ = false;
@ -540,8 +540,8 @@ void ACMISAC::DestructEncoderSafe() {
return;
}
WebRtc_Word32 ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMISAC::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
// Sanity checks
if (codec_inst_ptr_ == NULL) {
return -1;
@ -588,12 +588,12 @@ void ACMISAC::InternalDestructEncoderInst(void* ptr_inst) {
return;
}
WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte,
WebRtc_Word16 q_bwe,
WebRtc_Word32 rate,
bool is_red) {
WebRtc_Word16 jitter_info = 0;
int16_t ACMISAC::Transcode(uint8_t* bitstream,
int16_t* bitstream_len_byte,
int16_t q_bwe,
int32_t rate,
bool is_red) {
int16_t jitter_info = 0;
// transcode from a higher rate to lower rate sanity check
if (codec_inst_ptr_ == NULL) {
return -1;
@ -601,7 +601,7 @@ WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* bitstream,
*bitstream_len_byte = ACM_ISAC_GETNEWBITSTREAM(codec_inst_ptr_->inst, q_bwe,
jitter_info, rate,
(WebRtc_Word16*)bitstream,
(int16_t*)bitstream,
(is_red) ? 1 : 0);
if (*bitstream_len_byte < 0) {
@ -613,11 +613,11 @@ WebRtc_Word16 ACMISAC::Transcode(WebRtc_UWord8* bitstream,
}
}
WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 bit_rate) {
int16_t ACMISAC::SetBitRateSafe(int32_t bit_rate) {
if (codec_inst_ptr_ == NULL) {
return -1;
}
WebRtc_UWord16 encoder_samp_freq;
uint16_t encoder_samp_freq;
EncoderSampFreq(encoder_samp_freq);
bool reinit = false;
// change the BN of iSAC
@ -640,13 +640,13 @@ WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 bit_rate) {
reinit = true;
}
// store the bottleneck
isac_current_bn_ = (WebRtc_UWord16) bit_rate;
isac_current_bn_ = (uint16_t) bit_rate;
} else {
// invlaid rate
return -1;
}
WebRtc_Word16 status = 0;
int16_t status = 0;
if (reinit) {
// initialize and check if it is successful
if (ACM_ISAC_ENCODERINIT(codec_inst_ptr_->inst, isac_coding_mode_) < 0) {
@ -671,9 +671,9 @@ WebRtc_Word16 ACMISAC::SetBitRateSafe(WebRtc_Word32 bit_rate) {
return status;
}
WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
WebRtc_Word16 bandwidth_index = 0;
WebRtc_Word16 delay_index = 0;
int32_t ACMISAC::GetEstimatedBandwidthSafe() {
int16_t bandwidth_index = 0;
int16_t delay_index = 0;
int samp_rate;
// Get bandwidth information
@ -693,10 +693,10 @@ WebRtc_Word32 ACMISAC::GetEstimatedBandwidthSafe() {
}
}
WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
WebRtc_Word32 estimated_bandwidth) {
int32_t ACMISAC::SetEstimatedBandwidthSafe(
int32_t estimated_bandwidth) {
int samp_rate;
WebRtc_Word16 bandwidth_index;
int16_t bandwidth_index;
// Check sample frequency and choose appropriate table
samp_rate = ACM_ISAC_GETENCSAMPRATE(codec_inst_ptr_->inst);
@ -734,14 +734,14 @@ WebRtc_Word32 ACMISAC::SetEstimatedBandwidthSafe(
return 0;
}
WebRtc_Word32 ACMISAC::GetRedPayloadSafe(
int32_t ACMISAC::GetRedPayloadSafe(
#if (!defined(WEBRTC_CODEC_ISAC))
WebRtc_UWord8* /* red_payload */, WebRtc_Word16* /* payload_bytes */) {
uint8_t* /* red_payload */, int16_t* /* payload_bytes */) {
return -1;
#else
WebRtc_UWord8* red_payload, WebRtc_Word16* payload_bytes) {
WebRtc_Word16 bytes = WebRtcIsac_GetRedPayload(codec_inst_ptr_->inst,
(WebRtc_Word16*)red_payload);
uint8_t* red_payload, int16_t* payload_bytes) {
int16_t bytes = WebRtcIsac_GetRedPayload(codec_inst_ptr_->inst,
(int16_t*)red_payload);
if (bytes < 0) {
return -1;
}
@ -750,9 +750,9 @@ WebRtc_Word32 ACMISAC::GetRedPayloadSafe(
#endif
}
WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(
int16_t ACMISAC::UpdateDecoderSampFreq(
#ifdef WEBRTC_CODEC_ISAC
WebRtc_Word16 codec_id) {
int16_t codec_id) {
// The decoder supports only wideband and super-wideband.
if (ACMCodecDB::kISAC == codec_id) {
return WebRtcIsac_SetDecSampRate(codec_inst_ptr_->inst, 16000);
@ -763,15 +763,15 @@ WebRtc_Word16 ACMISAC::UpdateDecoderSampFreq(
return -1;
}
#else
WebRtc_Word16 /* codec_id */) {
int16_t /* codec_id */) {
return 0;
#endif
}
WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
int16_t ACMISAC::UpdateEncoderSampFreq(
#ifdef WEBRTC_CODEC_ISAC
WebRtc_UWord16 encoder_samp_freq_hz) {
WebRtc_UWord16 current_samp_rate_hz;
uint16_t encoder_samp_freq_hz) {
uint16_t current_samp_rate_hz;
EncoderSampFreq(current_samp_rate_hz);
if (current_samp_rate_hz != encoder_samp_freq_hz) {
@ -795,23 +795,23 @@ WebRtc_Word16 ACMISAC::UpdateEncoderSampFreq(
}
}
#else
WebRtc_UWord16 /* codec_id */) {
uint16_t /* codec_id */) {
#endif
return 0;
}
WebRtc_Word16 ACMISAC::EncoderSampFreq(WebRtc_UWord16& samp_freq_hz) {
int16_t ACMISAC::EncoderSampFreq(uint16_t& samp_freq_hz) {
samp_freq_hz = ACM_ISAC_GETENCSAMPRATE(codec_inst_ptr_->inst);
return 0;
}
WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
const WebRtc_UWord8 init_frame_size_msec,
const WebRtc_UWord16 init_rate_bit_per_sec,
int32_t ACMISAC::ConfigISACBandwidthEstimator(
const uint8_t init_frame_size_msec,
const uint16_t init_rate_bit_per_sec,
const bool enforce_frame_size) {
WebRtc_Word16 status;
int16_t status;
{
WebRtc_UWord16 samp_freq_hz;
uint16_t samp_freq_hz;
EncoderSampFreq(samp_freq_hz);
// TODO(turajs): at 32kHz we hardcode calling with 30ms and enforce
// the frame-size otherwise we might get error. Revise if
@ -836,14 +836,14 @@ WebRtc_Word32 ACMISAC::ConfigISACBandwidthEstimator(
return 0;
}
WebRtc_Word32 ACMISAC::SetISACMaxPayloadSize(
const WebRtc_UWord16 max_payload_len_bytes) {
int32_t ACMISAC::SetISACMaxPayloadSize(
const uint16_t max_payload_len_bytes) {
return ACM_ISAC_SETMAXPAYLOADSIZE(codec_inst_ptr_->inst,
max_payload_len_bytes);
}
WebRtc_Word32 ACMISAC::SetISACMaxRate(
const WebRtc_UWord32 max_rate_bit_per_sec) {
int32_t ACMISAC::SetISACMaxRate(
const uint32_t max_rate_bit_per_sec) {
return ACM_ISAC_SETMAXRATE(codec_inst_ptr_->inst, max_rate_bit_per_sec);
}
@ -852,14 +852,14 @@ void ACMISAC::UpdateFrameLen() {
encoder_params_.codec_inst.pacsize = frame_len_smpl_;
}
void ACMISAC::CurrentRate(WebRtc_Word32& rate_bit_per_sec) {
void ACMISAC::CurrentRate(int32_t& rate_bit_per_sec) {
if (isac_coding_mode_ == ADAPTIVE) {
ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &rate_bit_per_sec);
}
}
bool ACMISAC::DecoderParamsSafe(WebRtcACMCodecParams* dec_params,
const WebRtc_UWord8 payload_type) {
const uint8_t payload_type) {
if (decoder_initialized_) {
if (payload_type == decoder_params_.codec_inst.pltype) {
memcpy(dec_params, &decoder_params_, sizeof(WebRtcACMCodecParams));
@ -883,11 +883,11 @@ void ACMISAC::SaveDecoderParamSafe(const WebRtcACMCodecParams* codec_params) {
}
}
WebRtc_Word16 ACMISAC::REDPayloadISAC(const WebRtc_Word32 isac_rate,
const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
WebRtc_Word16* payload_len_bytes) {
WebRtc_Word16 status;
int16_t ACMISAC::REDPayloadISAC(const int32_t isac_rate,
const int16_t isac_bw_estimate,
uint8_t* payload,
int16_t* payload_len_bytes) {
int16_t status;
ReadLockScoped rl(codec_wrapper_lock_);
status = Transcode(payload, payload_len_bytes, isac_bw_estimate, isac_rate,
true);

View File

@ -24,95 +24,95 @@ enum IsacCodingMode {
class ACMISAC : public ACMGenericCodec {
public:
explicit ACMISAC(WebRtc_Word16 codec_id);
explicit ACMISAC(int16_t codec_id);
~ACMISAC();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 DeliverCachedIsacData(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte,
WebRtc_UWord32* timestamp,
WebRtcACMEncodingType* encoding_type,
const WebRtc_UWord16 isac_rate,
const WebRtc_UWord8 isac_bwestimate);
int16_t DeliverCachedIsacData(uint8_t* bitstream,
int16_t* bitstream_len_byte,
uint32_t* timestamp,
WebRtcACMEncodingType* encoding_type,
const uint16_t isac_rate,
const uint8_t isac_bwestimate);
WebRtc_Word16 DeliverCachedData(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */,
WebRtc_UWord32* /* timestamp */,
WebRtcACMEncodingType* /* encoding_type */) {
int16_t DeliverCachedData(uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */,
uint32_t* /* timestamp */,
WebRtcACMEncodingType* /* encoding_type */) {
return -1;
}
WebRtc_Word16 UpdateDecoderSampFreq(WebRtc_Word16 codec_id);
int16_t UpdateDecoderSampFreq(int16_t codec_id);
WebRtc_Word16 UpdateEncoderSampFreq(WebRtc_UWord16 samp_freq_hz);
int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz);
WebRtc_Word16 EncoderSampFreq(WebRtc_UWord16& samp_freq_hz);
int16_t EncoderSampFreq(uint16_t& samp_freq_hz);
WebRtc_Word32 ConfigISACBandwidthEstimator(
const WebRtc_UWord8 init_frame_size_msec,
const WebRtc_UWord16 init_rate_bit_per_sec,
int32_t ConfigISACBandwidthEstimator(
const uint8_t init_frame_size_msec,
const uint16_t init_rate_bit_per_sec,
const bool enforce_frame_size);
WebRtc_Word32 SetISACMaxPayloadSize(
const WebRtc_UWord16 max_payload_len_bytes);
int32_t SetISACMaxPayloadSize(
const uint16_t max_payload_len_bytes);
WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_rate_bit_per_sec);
int32_t SetISACMaxRate(const uint32_t max_rate_bit_per_sec);
WebRtc_Word16 REDPayloadISAC(const WebRtc_Word32 isac_rate,
const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
WebRtc_Word16* payload_len_bytes);
int16_t REDPayloadISAC(const int32_t isac_rate,
const int16_t isac_bw_estimate,
uint8_t* payload,
int16_t* payload_len_bytes);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 bit_rate);
int16_t SetBitRateSafe(const int32_t bit_rate);
WebRtc_Word32 GetEstimatedBandwidthSafe();
int32_t GetEstimatedBandwidthSafe();
WebRtc_Word32 SetEstimatedBandwidthSafe(WebRtc_Word32 estimated_bandwidth);
int32_t SetEstimatedBandwidthSafe(int32_t estimated_bandwidth);
WebRtc_Word32 GetRedPayloadSafe(WebRtc_UWord8* red_payload,
WebRtc_Word16* payload_bytes);
int32_t GetRedPayloadSafe(uint8_t* red_payload,
int16_t* payload_bytes);
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 Transcode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte,
WebRtc_Word16 q_bwe,
WebRtc_Word32 rate,
bool is_red);
int16_t Transcode(uint8_t* bitstream,
int16_t* bitstream_len_byte,
int16_t q_bwe,
int32_t rate,
bool is_red);
void CurrentRate(WebRtc_Word32& rate_bit_per_sec);
void CurrentRate(int32_t& rate_bit_per_sec);
void UpdateFrameLen();
bool DecoderParamsSafe(WebRtcACMCodecParams *dec_params,
const WebRtc_UWord8 payload_type);
const uint8_t payload_type);
void SaveDecoderParamSafe(const WebRtcACMCodecParams* codec_params);
@ -120,8 +120,8 @@ class ACMISAC : public ACMGenericCodec {
bool is_enc_initialized_;
IsacCodingMode isac_coding_mode_;
bool enforce_frame_size_;
WebRtc_Word32 isac_current_bn_;
WebRtc_UWord16 samples_in_10ms_audio_;
int32_t isac_current_bn_;
uint16_t samples_in_10ms_audio_;
WebRtcACMCodecParams decoder_params_32khz_;
};

View File

@ -77,10 +77,10 @@ ACMNetEQ::~ACMNetEQ() {
}
}
WebRtc_Word32 ACMNetEQ::Init() {
int32_t ACMNetEQ::Init() {
CriticalSectionScoped lock(neteq_crit_sect_);
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (InitByIdxSafe(idx) < 0) {
return -1;
}
@ -117,7 +117,7 @@ WebRtc_Word32 ACMNetEQ::Init() {
return 0;
}
WebRtc_Word16 ACMNetEQ::InitByIdxSafe(const WebRtc_Word16 idx) {
int16_t ACMNetEQ::InitByIdxSafe(const int16_t idx) {
int memory_size_bytes;
if (WebRtcNetEQ_AssignSize(&memory_size_bytes) != 0) {
LogError("AssignSize", idx);
@ -163,7 +163,7 @@ WebRtc_Word16 ACMNetEQ::InitByIdxSafe(const WebRtc_Word16 idx) {
return 0;
}
WebRtc_Word16 ACMNetEQ::EnableVADByIdxSafe(const WebRtc_Word16 idx) {
int16_t ACMNetEQ::EnableVADByIdxSafe(const int16_t idx) {
if (ptr_vadinst_[idx] == NULL) {
if (WebRtcVad_Create(&ptr_vadinst_[idx]) < 0) {
ptr_vadinst_[idx] = NULL;
@ -196,15 +196,15 @@ WebRtc_Word16 ACMNetEQ::EnableVADByIdxSafe(const WebRtc_Word16 idx) {
return 0;
}
WebRtc_Word32 ACMNetEQ::AllocatePacketBuffer(
int32_t ACMNetEQ::AllocatePacketBuffer(
const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs) {
int16_t num_codecs) {
// Due to WebRtcNetEQ_GetRecommendedBufferSize
// the following has to be int otherwise we will have compiler error
// if not casted
CriticalSectionScoped lock(neteq_crit_sect_);
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (AllocatePacketBufferByIdxSafe(used_codecs, num_codecs, idx) < 0) {
return -1;
}
@ -212,10 +212,10 @@ WebRtc_Word32 ACMNetEQ::AllocatePacketBuffer(
return 0;
}
WebRtc_Word16 ACMNetEQ::AllocatePacketBufferByIdxSafe(
int16_t ACMNetEQ::AllocatePacketBufferByIdxSafe(
const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs,
const WebRtc_Word16 idx) {
int16_t num_codecs,
const int16_t idx) {
int max_num_packets;
int buffer_size_in_bytes;
int per_packet_overhead_bytes;
@ -249,7 +249,7 @@ WebRtc_Word16 ACMNetEQ::AllocatePacketBufferByIdxSafe(
neteq_packet_buffer_[idx] = NULL;
}
neteq_packet_buffer_[idx] = (WebRtc_Word16 *) malloc(buffer_size_in_bytes);
neteq_packet_buffer_[idx] = (int16_t *) malloc(buffer_size_in_bytes);
if (neteq_packet_buffer_[idx] == NULL) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"AllocatePacketBufferByIdxSafe: NetEq Initialization error: "
@ -269,10 +269,10 @@ WebRtc_Word16 ACMNetEQ::AllocatePacketBufferByIdxSafe(
return 0;
}
WebRtc_Word32 ACMNetEQ::SetExtraDelay(const WebRtc_Word32 delay_in_ms) {
int32_t ACMNetEQ::SetExtraDelay(const int32_t delay_in_ms) {
CriticalSectionScoped lock(neteq_crit_sect_);
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetExtraDelay: NetEq is not initialized.");
@ -287,10 +287,10 @@ WebRtc_Word32 ACMNetEQ::SetExtraDelay(const WebRtc_Word32 delay_in_ms) {
return 0;
}
WebRtc_Word32 ACMNetEQ::SetAVTPlayout(const bool enable) {
int32_t ACMNetEQ::SetAVTPlayout(const bool enable) {
CriticalSectionScoped lock(neteq_crit_sect_);
if (avt_playout_ != enable) {
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetAVTPlayout: NetEq is not initialized.");
@ -311,17 +311,17 @@ bool ACMNetEQ::avt_playout() const {
return avt_playout_;
}
WebRtc_Word32 ACMNetEQ::CurrentSampFreqHz() const {
int32_t ACMNetEQ::CurrentSampFreqHz() const {
CriticalSectionScoped lock(neteq_crit_sect_);
if (!is_initialized_[0]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"CurrentSampFreqHz: NetEq is not initialized.");
return -1;
}
return (WebRtc_Word32)(1000 * current_samp_freq_khz_);
return (int32_t)(1000 * current_samp_freq_khz_);
}
WebRtc_Word32 ACMNetEQ::SetPlayoutMode(const AudioPlayoutMode mode) {
int32_t ACMNetEQ::SetPlayoutMode(const AudioPlayoutMode mode) {
CriticalSectionScoped lock(neteq_crit_sect_);
if (playout_mode_ == mode)
return 0;
@ -375,7 +375,7 @@ AudioPlayoutMode ACMNetEQ::playout_mode() const {
return playout_mode_;
}
WebRtc_Word32 ACMNetEQ::NetworkStatistics(
int32_t ACMNetEQ::NetworkStatistics(
ACMNetworkStatistics* statistics) const {
WebRtcNetEQ_NetworkStatistics stats;
CriticalSectionScoped lock(neteq_crit_sect_);
@ -435,10 +435,10 @@ WebRtc_Word32 ACMNetEQ::NetworkStatistics(
return 0;
}
WebRtc_Word32 ACMNetEQ::RecIn(const WebRtc_UWord8* incoming_payload,
const WebRtc_Word32 length_payload,
const WebRtcRTPHeader& rtp_info) {
WebRtc_Word16 payload_length = static_cast<WebRtc_Word16>(length_payload);
int32_t ACMNetEQ::RecIn(const uint8_t* incoming_payload,
const int32_t length_payload,
const WebRtcRTPHeader& rtp_info) {
int16_t payload_length = static_cast<int16_t>(length_payload);
// translate to NetEq struct
WebRtcNetEQ_RTPInfo neteq_rtpinfo;
@ -453,10 +453,10 @@ WebRtc_Word32 ACMNetEQ::RecIn(const WebRtc_UWord8* incoming_payload,
// the least significant bits. (32-6) bits cover 2^(32-6) = 67108864 ms.
// we masked 6 most significant bits of 32-bit so we don't loose resolution
// when do the following multiplication.
const WebRtc_UWord32 now_in_ms =
static_cast<WebRtc_UWord32>(
const uint32_t now_in_ms =
static_cast<uint32_t>(
TickTime::MillisecondTimestamp() & 0x03ffffff);
WebRtc_UWord32 recv_timestamp = static_cast<WebRtc_UWord32>(
uint32_t recv_timestamp = static_cast<uint32_t>(
current_samp_freq_khz_ * now_in_ms);
int status;
@ -505,13 +505,13 @@ WebRtc_Word32 ACMNetEQ::RecIn(const WebRtc_UWord8* incoming_payload,
return 0;
}
WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
int32_t ACMNetEQ::RecOut(AudioFrame& audio_frame) {
enum WebRtcNetEQOutputType type;
WebRtc_Word16 payload_len_sample;
int16_t payload_len_sample;
enum WebRtcNetEQOutputType type_master;
enum WebRtcNetEQOutputType type_slave;
WebRtc_Word16 payload_len_sample_slave;
int16_t payload_len_sample_slave;
CriticalSectionScoped lockNetEq(neteq_crit_sect_);
@ -546,8 +546,8 @@ WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
"RecOut: NetEq is not initialized.");
return -1;
}
WebRtc_Word16 payload_master[480];
WebRtc_Word16 payload_slave[480];
int16_t payload_master[480];
int16_t payload_slave[480];
{
WriteLockScoped lockCodec(*decode_lock_);
if (WebRtcNetEQ_RecOutMasterSlave(inst_[0], payload_master,
@ -590,11 +590,11 @@ WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
if (payload_len_sample > payload_len_sample_slave) {
memset(&payload_slave[payload_len_sample_slave], 0,
(payload_len_sample - payload_len_sample_slave) *
sizeof(WebRtc_Word16));
sizeof(int16_t));
}
}
for (WebRtc_Word16 n = 0; n < payload_len_sample; n++) {
for (int16_t n = 0; n < payload_len_sample; n++) {
audio_frame.data_[n << 1] = payload_master[n];
audio_frame.data_[(n << 1) + 1] = payload_slave[n];
}
@ -610,7 +610,7 @@ WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
}
audio_frame.samples_per_channel_ =
static_cast<WebRtc_UWord16>(payload_len_sample);
static_cast<uint16_t>(payload_len_sample);
// NetEq always returns 10 ms of audio.
current_samp_freq_khz_ =
static_cast<float>(audio_frame.samples_per_channel_) / 10.0f;
@ -660,8 +660,8 @@ WebRtc_Word32 ACMNetEQ::RecOut(AudioFrame& audio_frame) {
// When ACMGenericCodec has set the codec specific parameters in codec_def
// it calls AddCodec() to add the new codec to the NetEQ database.
WebRtc_Word32 ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codec_def,
bool to_master) {
int32_t ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codec_def,
bool to_master) {
if (codec_def == NULL) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"ACMNetEQ::AddCodec: error, codec_def is NULL");
@ -669,7 +669,7 @@ WebRtc_Word32 ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codec_def,
}
CriticalSectionScoped lock(neteq_crit_sect_);
WebRtc_Word16 idx;
int16_t idx;
if (to_master) {
idx = 0;
} else {
@ -693,11 +693,11 @@ WebRtc_Word32 ACMNetEQ::AddCodec(WebRtcNetEQ_CodecDef* codec_def,
// Creates a Word16 RTP packet out of a Word8 payload and an rtp info struct.
// Must be byte order safe.
void ACMNetEQ::RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
const WebRtc_Word32 payload_length_bytes,
void ACMNetEQ::RTPPack(int16_t* rtp_packet, const int8_t* payload,
const int32_t payload_length_bytes,
const WebRtcRTPHeader& rtp_info) {
WebRtc_Word32 idx = 0;
WEBRTC_SPL_SET_BYTE(rtp_packet, (WebRtc_Word8) 0x80, idx);
int32_t idx = 0;
WEBRTC_SPL_SET_BYTE(rtp_packet, (int8_t) 0x80, idx);
idx++;
WEBRTC_SPL_SET_BYTE(rtp_packet, rtp_info.header.payloadType, idx);
idx++;
@ -737,7 +737,7 @@ void ACMNetEQ::RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
WEBRTC_SPL_SET_BYTE(rtp_packet, WEBRTC_SPL_GET_BYTE(&(rtp_info.header.ssrc),
0), idx);
idx++;
for (WebRtc_Word16 i = 0; i < payload_length_bytes; i++) {
for (int16_t i = 0; i < payload_length_bytes; i++) {
WEBRTC_SPL_SET_BYTE(rtp_packet, payload[i], idx);
idx++;
}
@ -748,12 +748,12 @@ void ACMNetEQ::RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
}
}
WebRtc_Word16 ACMNetEQ::EnableVAD() {
int16_t ACMNetEQ::EnableVAD() {
CriticalSectionScoped lock(neteq_crit_sect_);
if (vad_status_) {
return 0;
}
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVADStatus: NetEq is not initialized.");
@ -776,7 +776,7 @@ ACMVADMode ACMNetEQ::vad_mode() const {
return vad_mode_;
}
WebRtc_Word16 ACMNetEQ::SetVADMode(const ACMVADMode mode) {
int16_t ACMNetEQ::SetVADMode(const ACMVADMode mode) {
CriticalSectionScoped lock(neteq_crit_sect_);
if ((mode < VADNormal) || (mode > VADVeryAggr)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
@ -784,7 +784,7 @@ WebRtc_Word16 ACMNetEQ::SetVADMode(const ACMVADMode mode) {
"supported");
return -1;
} else {
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetVADMode: NetEq is not initialized.");
@ -800,9 +800,9 @@ WebRtc_Word16 ACMNetEQ::SetVADMode(const ACMVADMode mode) {
}
}
WebRtc_Word32 ACMNetEQ::FlushBuffers() {
int32_t ACMNetEQ::FlushBuffers() {
CriticalSectionScoped lock(neteq_crit_sect_);
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"FlushBuffers: NetEq is not initialized.");
@ -816,8 +816,8 @@ WebRtc_Word32 ACMNetEQ::FlushBuffers() {
return 0;
}
WebRtc_Word16 ACMNetEQ::RemoveCodec(WebRtcNetEQDecoder codec_idx,
bool is_stereo) {
int16_t ACMNetEQ::RemoveCodec(WebRtcNetEQDecoder codec_idx,
bool is_stereo) {
// sanity check
if ((codec_idx <= kDecoderReservedStart) ||
(codec_idx >= kDecoderReservedEnd)) {
@ -848,10 +848,10 @@ WebRtc_Word16 ACMNetEQ::RemoveCodec(WebRtcNetEQDecoder codec_idx,
return 0;
}
WebRtc_Word16 ACMNetEQ::SetBackgroundNoiseMode(
int16_t ACMNetEQ::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode) {
CriticalSectionScoped lock(neteq_crit_sect_);
for (WebRtc_Word16 idx = 0; idx < num_slaves_ + 1; idx++) {
for (int16_t idx = 0; idx < num_slaves_ + 1; idx++) {
if (!is_initialized_[idx]) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"SetBackgroundNoiseMode: NetEq is not initialized.");
@ -865,7 +865,7 @@ WebRtc_Word16 ACMNetEQ::SetBackgroundNoiseMode(
return 0;
}
WebRtc_Word16 ACMNetEQ::BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) {
int16_t ACMNetEQ::BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) {
WebRtcNetEQBGNMode my_mode;
CriticalSectionScoped lock(neteq_crit_sect_);
if (!is_initialized_[0]) {
@ -882,13 +882,13 @@ WebRtc_Word16 ACMNetEQ::BackgroundNoiseMode(ACMBackgroundNoiseMode& mode) {
return 0;
}
void ACMNetEQ::set_id(WebRtc_Word32 id) {
void ACMNetEQ::set_id(int32_t id) {
CriticalSectionScoped lock(neteq_crit_sect_);
id_ = id;
}
void ACMNetEQ::LogError(const char* neteq_func_name,
const WebRtc_Word16 idx) const {
const int16_t idx) const {
char error_name[NETEQ_ERR_MSG_LEN_BYTE];
char my_func_name[50];
int neteq_error_code = WebRtcNetEQ_GetErrorCode(inst_[idx]);
@ -902,7 +902,7 @@ void ACMNetEQ::LogError(const char* neteq_func_name,
" %s", idx, my_func_name, neteq_error_code, error_name);
}
WebRtc_Word32 ACMNetEQ::PlayoutTimestamp(WebRtc_UWord32& timestamp) {
int32_t ACMNetEQ::PlayoutTimestamp(uint32_t& timestamp) {
CriticalSectionScoped lock(neteq_crit_sect_);
if (WebRtcNetEQ_GetSpeechTimeStamp(inst_[0], &timestamp) < 0) {
LogError("GetSpeechTimeStamp", 0);
@ -944,10 +944,10 @@ void ACMNetEQ::RemoveNetEQSafe(int index) {
}
}
WebRtc_Word16 ACMNetEQ::AddSlave(const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs) {
int16_t ACMNetEQ::AddSlave(const WebRtcNetEQDecoder* used_codecs,
int16_t num_codecs) {
CriticalSectionScoped lock(neteq_crit_sect_);
const WebRtc_Word16 slave_idx = 1;
const int16_t slave_idx = 1;
if (num_slaves_ < 1) {
// initialize the receiver, this also sets up VAD.
if (InitByIdxSafe(slave_idx) < 0) {
@ -1050,7 +1050,7 @@ void ACMNetEQ::set_received_stereo(bool received_stereo) {
received_stereo_ = received_stereo;
}
WebRtc_UWord8 ACMNetEQ::num_slaves() {
uint8_t ACMNetEQ::num_slaves() {
CriticalSectionScoped lock(neteq_crit_sect_);
return num_slaves_;
}

View File

@ -48,7 +48,7 @@ class ACMNetEQ {
// -1 if NetEQ or VAD returned an error or
// if out of memory.
//
WebRtc_Word32 Init();
int32_t Init();
//
// RecIn()
@ -64,9 +64,9 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 RecIn(const WebRtc_UWord8* incoming_payload,
const WebRtc_Word32 length_payload,
const WebRtcRTPHeader& rtp_info);
int32_t RecIn(const uint8_t* incoming_payload,
const int32_t length_payload,
const WebRtcRTPHeader& rtp_info);
//
// RecOut()
@ -79,7 +79,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// -1 if NetEQ returned an error.
//
WebRtc_Word32 RecOut(AudioFrame& audio_frame);
int32_t RecOut(AudioFrame& audio_frame);
//
// AddCodec()
@ -94,8 +94,8 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 AddCodec(WebRtcNetEQ_CodecDef *codec_def,
bool to_master = true);
int32_t AddCodec(WebRtcNetEQ_CodecDef *codec_def,
bool to_master = true);
//
// AllocatePacketBuffer()
@ -108,8 +108,8 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 AllocatePacketBuffer(const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs);
int32_t AllocatePacketBuffer(const WebRtcNetEQDecoder* used_codecs,
int16_t num_codecs);
//
// SetExtraDelay()
@ -121,7 +121,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 SetExtraDelay(const WebRtc_Word32 delay_in_ms);
int32_t SetExtraDelay(const int32_t delay_in_ms);
//
// SetAVTPlayout()
@ -133,7 +133,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 SetAVTPlayout(const bool enable);
int32_t SetAVTPlayout(const bool enable);
//
// AVTPlayout()
@ -150,7 +150,7 @@ class ACMNetEQ {
//
// Return value : Sampling frequency in Hz.
//
WebRtc_Word32 CurrentSampFreqHz() const;
int32_t CurrentSampFreqHz() const;
//
// SetPlayoutMode()
@ -163,7 +163,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 SetPlayoutMode(const AudioPlayoutMode mode);
int32_t SetPlayoutMode(const AudioPlayoutMode mode);
//
// PlayoutMode()
@ -183,7 +183,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics* statistics) const;
int32_t NetworkStatistics(ACMNetworkStatistics* statistics) const;
//
// VADMode()
@ -203,7 +203,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// -1 if an error occurred.
//
WebRtc_Word16 SetVADMode(const ACMVADMode mode);
int16_t SetVADMode(const ACMVADMode mode);
//
// DecodeLock()
@ -222,7 +222,7 @@ class ACMNetEQ {
// Return value : 0 if ok.
// -1 if NetEQ returned an error.
//
WebRtc_Word32 FlushBuffers();
int32_t FlushBuffers();
//
// RemoveCodec()
@ -234,8 +234,8 @@ class ACMNetEQ {
// Return value : 0 if ok.
// -1 if an error occurred.
//
WebRtc_Word16 RemoveCodec(WebRtcNetEQDecoder codec_idx,
bool is_stereo = false);
int16_t RemoveCodec(WebRtcNetEQDecoder codec_idx,
bool is_stereo = false);
//
// SetBackgroundNoiseMode()
@ -248,7 +248,7 @@ class ACMNetEQ {
// Return value : 0 if succeeded,
// -1 if failed to set the mode.
//
WebRtc_Word16 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
int16_t SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
//
// BackgroundNoiseMode()
@ -256,21 +256,21 @@ class ACMNetEQ {
//
// Return value : The mode of background noise.
//
WebRtc_Word16 BackgroundNoiseMode(ACMBackgroundNoiseMode& mode);
int16_t BackgroundNoiseMode(ACMBackgroundNoiseMode& mode);
void set_id(WebRtc_Word32 id);
void set_id(int32_t id);
WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32& timestamp);
int32_t PlayoutTimestamp(uint32_t& timestamp);
void set_received_stereo(bool received_stereo);
WebRtc_UWord8 num_slaves();
uint8_t num_slaves();
// Delete all slaves.
void RemoveSlaves();
WebRtc_Word16 AddSlave(const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs);
int16_t AddSlave(const WebRtcNetEQDecoder* used_codecs,
int16_t num_codecs);
void BufferSpec(int& num_packets, int& size_bytes, int& overhead_bytes) {
num_packets = min_of_max_num_packets_;
@ -292,13 +292,13 @@ class ACMNetEQ {
// Output:
// - rtp_packet : The RTP packet.
//
static void RTPPack(WebRtc_Word16* rtp_packet, const WebRtc_Word8* payload,
const WebRtc_Word32 payload_length_bytes,
static void RTPPack(int16_t* rtp_packet, const int8_t* payload,
const int32_t payload_length_bytes,
const WebRtcRTPHeader& rtp_info);
void LogError(const char* neteq_func_name, const WebRtc_Word16 idx) const;
void LogError(const char* neteq_func_name, const int16_t idx) const;
WebRtc_Word16 InitByIdxSafe(const WebRtc_Word16 idx);
int16_t InitByIdxSafe(const int16_t idx);
//
// EnableVAD()
@ -307,14 +307,14 @@ class ACMNetEQ {
// Return value : 0 if ok.
// -1 if an error occurred.
//
WebRtc_Word16 EnableVAD();
int16_t EnableVAD();
WebRtc_Word16 EnableVADByIdxSafe(const WebRtc_Word16 idx);
int16_t EnableVADByIdxSafe(const int16_t idx);
WebRtc_Word16 AllocatePacketBufferByIdxSafe(
int16_t AllocatePacketBufferByIdxSafe(
const WebRtcNetEQDecoder* used_codecs,
WebRtc_Word16 num_codecs,
const WebRtc_Word16 idx);
int16_t num_codecs,
const int16_t idx);
// Delete the NetEQ corresponding to |index|.
void RemoveNetEQSafe(int index);
@ -324,9 +324,9 @@ class ACMNetEQ {
void* inst_[MAX_NUM_SLAVE_NETEQ + 1];
void* inst_mem_[MAX_NUM_SLAVE_NETEQ + 1];
WebRtc_Word16* neteq_packet_buffer_[MAX_NUM_SLAVE_NETEQ + 1];
int16_t* neteq_packet_buffer_[MAX_NUM_SLAVE_NETEQ + 1];
WebRtc_Word32 id_;
int32_t id_;
float current_samp_freq_khz_;
bool avt_playout_;
AudioPlayoutMode playout_mode_;
@ -338,11 +338,11 @@ class ACMNetEQ {
ACMVADMode vad_mode_;
RWLockWrapper* decode_lock_;
bool is_initialized_[MAX_NUM_SLAVE_NETEQ + 1];
WebRtc_UWord8 num_slaves_;
uint8_t num_slaves_;
bool received_stereo_;
void* master_slave_info_;
AudioFrame::VADActivity previous_audio_activity_;
WebRtc_Word32 extra_delay_;
int32_t extra_delay_;
CriticalSectionWrapper* callback_crit_sect_;
// Minimum of "max number of packets," among all NetEq instances.

View File

@ -68,7 +68,7 @@ void AcmNetEqTest::InsertZeroPacket(uint16_t sequence_number,
rtp_header.header.payloadType = payload_type;
rtp_header.header.markerBit = marker_bit;
rtp_header.type.Audio.channel = 1;
ASSERT_EQ(0, neteq_.RecIn(reinterpret_cast<WebRtc_UWord8*>(payload),
ASSERT_EQ(0, neteq_.RecIn(reinterpret_cast<uint8_t*>(payload),
len_payload_bytes, rtp_header));
}

View File

@ -25,7 +25,7 @@ namespace webrtc {
#ifndef WEBRTC_CODEC_PCM16
ACMPCM16B::ACMPCM16B(WebRtc_Word16 /* codec_id */) {
ACMPCM16B::ACMPCM16B(int16_t /* codec_id */) {
return;
}
@ -33,32 +33,32 @@ ACMPCM16B::~ACMPCM16B() {
return;
}
WebRtc_Word16 ACMPCM16B::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMPCM16B::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMPCM16B::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMPCM16B::InternalInitEncoder(
int16_t ACMPCM16B::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMPCM16B::InternalInitDecoder(
int16_t ACMPCM16B::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -66,11 +66,11 @@ ACMGenericCodec* ACMPCM16B::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMPCM16B::InternalCreateEncoder() {
int16_t ACMPCM16B::InternalCreateEncoder() {
return -1;
}
WebRtc_Word16 ACMPCM16B::InternalCreateDecoder() {
int16_t ACMPCM16B::InternalCreateDecoder() {
return -1;
}
@ -91,7 +91,7 @@ void ACMPCM16B::SplitStereoPacket(uint8_t* /*payload*/,
}
#else //===================== Actual Implementation =======================
ACMPCM16B::ACMPCM16B(WebRtc_Word16 codec_id) {
ACMPCM16B::ACMPCM16B(int16_t codec_id) {
codec_id_ = codec_id;
sampling_freq_hz_ = ACMCodecDB::CodecFreq(codec_id_);
}
@ -100,8 +100,8 @@ ACMPCM16B::~ACMPCM16B() {
return;
}
WebRtc_Word16 ACMPCM16B::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMPCM16B::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
*bitstream_len_byte = WebRtcPcm16b_Encode(&in_audio_[in_audio_ix_read_],
frame_len_smpl_ * num_channels_,
bitstream);
@ -111,28 +111,28 @@ WebRtc_Word16 ACMPCM16B::InternalEncode(WebRtc_UWord8* bitstream,
return *bitstream_len_byte;
}
WebRtc_Word16 ACMPCM16B::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMPCM16B::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCM16B::InternalInitEncoder(
int16_t ACMPCM16B::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCM16B::InternalInitDecoder(
int16_t ACMPCM16B::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word32 ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMPCM16B::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
// Fill up the structure by calling "SET_CODEC_PAR" & "SET_PCMU_FUNCTION".
// Then call NetEQ to add the codec to it's database.
if (codec_inst.channels == 1) {
@ -190,12 +190,12 @@ ACMGenericCodec* ACMPCM16B::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMPCM16B::InternalCreateEncoder() {
int16_t ACMPCM16B::InternalCreateEncoder() {
// PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCM16B::InternalCreateDecoder() {
int16_t ACMPCM16B::InternalCreateDecoder() {
// PCM has no instance.
return 0;
}

View File

@ -17,42 +17,42 @@ namespace webrtc {
class ACMPCM16B : public ACMGenericCodec {
public:
explicit ACMPCM16B(WebRtc_Word16 codec_id);
explicit ACMPCM16B(int16_t codec_id);
~ACMPCM16B();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
void SplitStereoPacket(uint8_t* payload, int32_t* payload_length);
WebRtc_Word32 sampling_freq_hz_;
int32_t sampling_freq_hz_;
};
} // namespace webrtc

View File

@ -21,7 +21,7 @@
namespace webrtc {
ACMPCMA::ACMPCMA(WebRtc_Word16 codec_id) {
ACMPCMA::ACMPCMA(int16_t codec_id) {
codec_id_ = codec_id;
}
@ -29,39 +29,39 @@ ACMPCMA::~ACMPCMA() {
return;
}
WebRtc_Word16 ACMPCMA::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMPCMA::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
*bitstream_len_byte = WebRtcG711_EncodeA(NULL, &in_audio_[in_audio_ix_read_],
frame_len_smpl_ * num_channels_,
(WebRtc_Word16*) bitstream);
(int16_t*) bitstream);
// Increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer.
in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
return *bitstream_len_byte;
}
WebRtc_Word16 ACMPCMA::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMPCMA::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCMA::InternalInitEncoder(
int16_t ACMPCMA::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMA::InternalInitDecoder(
int16_t ACMPCMA::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word32 ACMPCMA::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMPCMA::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_PCMA_FUNCTION."
// Then call NetEQ to add the codec to it's database.
@ -80,12 +80,12 @@ ACMGenericCodec* ACMPCMA::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMPCMA::InternalCreateEncoder() {
int16_t ACMPCMA::InternalCreateEncoder() {
// PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMA::InternalCreateDecoder() {
int16_t ACMPCMA::InternalCreateDecoder() {
// PCM has no instance.
return 0;
}

View File

@ -17,36 +17,36 @@ namespace webrtc {
class ACMPCMA : public ACMGenericCodec {
public:
explicit ACMPCMA(WebRtc_Word16 codec_id);
explicit ACMPCMA(int16_t codec_id);
~ACMPCMA();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);

View File

@ -21,7 +21,7 @@
namespace webrtc {
ACMPCMU::ACMPCMU(WebRtc_Word16 codec_id) {
ACMPCMU::ACMPCMU(int16_t codec_id) {
codec_id_ = codec_id;
}
@ -29,39 +29,39 @@ ACMPCMU::~ACMPCMU() {
return;
}
WebRtc_Word16 ACMPCMU::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
int16_t ACMPCMU::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
*bitstream_len_byte = WebRtcG711_EncodeU(NULL, &in_audio_[in_audio_ix_read_],
frame_len_smpl_ * num_channels_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
// Increment the read index this tell the caller that how far
// we have gone forward in reading the audio buffer.
in_audio_ix_read_ += frame_len_smpl_ * num_channels_;
return *bitstream_len_byte;
}
WebRtc_Word16 ACMPCMU::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMPCMU::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMPCMU::InternalInitEncoder(
int16_t ACMPCMU::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMU::InternalInitDecoder(
int16_t ACMPCMU::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization, PCM has no instance.
return 0;
}
WebRtc_Word32 ACMPCMU::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMPCMU::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
// Fill up the structure by calling
// "SET_CODEC_PAR" & "SET_PCMU_FUNCTION."
// Then call NetEQ to add the codec to it's database.
@ -80,12 +80,12 @@ ACMGenericCodec* ACMPCMU::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMPCMU::InternalCreateEncoder() {
int16_t ACMPCMU::InternalCreateEncoder() {
// PCM has no instance.
return 0;
}
WebRtc_Word16 ACMPCMU::InternalCreateDecoder() {
int16_t ACMPCMU::InternalCreateDecoder() {
// PCM has no instance.
return 0;
}

View File

@ -17,36 +17,36 @@ namespace webrtc {
class ACMPCMU : public ACMGenericCodec {
public:
explicit ACMPCMU(WebRtc_Word16 codec_id);
explicit ACMPCMU(int16_t codec_id);
~ACMPCMU();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);

View File

@ -18,7 +18,7 @@
namespace webrtc {
ACMRED::ACMRED(WebRtc_Word16 codec_id) {
ACMRED::ACMRED(int16_t codec_id) {
codec_id_ = codec_id;
}
@ -26,37 +26,37 @@ ACMRED::~ACMRED() {
return;
}
WebRtc_Word16 ACMRED::InternalEncode(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMRED::InternalEncode(uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
// RED is never used as an encoder
// RED has no instance
return 0;
}
WebRtc_Word16 ACMRED::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMRED::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMRED::InternalInitEncoder(
int16_t ACMRED::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// RED has no instance
return 0;
}
WebRtc_Word16 ACMRED::InternalInitDecoder(
int16_t ACMRED::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
// This codec does not need initialization,
// RED has no instance
return 0;
}
WebRtc_Word32 ACMRED::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMRED::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
// Todo:
// log error
@ -76,12 +76,12 @@ ACMGenericCodec* ACMRED::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMRED::InternalCreateEncoder() {
int16_t ACMRED::InternalCreateEncoder() {
// RED has no instance
return 0;
}
WebRtc_Word16 ACMRED::InternalCreateDecoder() {
int16_t ACMRED::InternalCreateDecoder() {
// RED has no instance
return 0;
}

View File

@ -17,36 +17,36 @@ namespace webrtc {
class ACMRED : public ACMGenericCodec {
public:
explicit ACMRED(WebRtc_Word16 codec_id);
explicit ACMRED(int16_t codec_id);
~ACMRED();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
};

View File

@ -27,25 +27,25 @@ ACMResampler::~ACMResampler() {
delete resampler_crit_sect_;
}
WebRtc_Word16 ACMResampler::Resample10Msec(const WebRtc_Word16* in_audio,
WebRtc_Word32 in_freq_hz,
WebRtc_Word16* out_audio,
WebRtc_Word32 out_freq_hz,
WebRtc_UWord8 num_audio_channels) {
int16_t ACMResampler::Resample10Msec(const int16_t* in_audio,
int32_t in_freq_hz,
int16_t* out_audio,
int32_t out_freq_hz,
uint8_t num_audio_channels) {
CriticalSectionScoped cs(resampler_crit_sect_);
if (in_freq_hz == out_freq_hz) {
size_t length = static_cast<size_t>(in_freq_hz * num_audio_channels / 100);
memcpy(out_audio, in_audio, length * sizeof(WebRtc_Word16));
return static_cast<WebRtc_Word16>(in_freq_hz / 100);
memcpy(out_audio, in_audio, length * sizeof(int16_t));
return static_cast<int16_t>(in_freq_hz / 100);
}
// |maxLen| is maximum number of samples for 10ms at 48kHz.
int max_len = 480 * num_audio_channels;
int length_in = (WebRtc_Word16)(in_freq_hz / 100) * num_audio_channels;
int length_in = (int16_t)(in_freq_hz / 100) * num_audio_channels;
int out_len;
WebRtc_Word32 ret;
int32_t ret;
ResamplerType type;
type = (num_audio_channels == 1) ? kResamplerSynchronous :
kResamplerSynchronousStereo;
@ -64,7 +64,7 @@ WebRtc_Word16 ACMResampler::Resample10Msec(const WebRtc_Word16* in_audio,
return -1;
}
WebRtc_Word16 out_audio_len_smpl = (WebRtc_Word16) out_len /
int16_t out_audio_len_smpl = (int16_t) out_len /
num_audio_channels;
return out_audio_len_smpl;

View File

@ -23,11 +23,11 @@ class ACMResampler {
ACMResampler();
~ACMResampler();
WebRtc_Word16 Resample10Msec(const WebRtc_Word16* in_audio,
const WebRtc_Word32 in_freq_hz,
WebRtc_Word16* out_audio,
const WebRtc_Word32 out_freq_hz,
WebRtc_UWord8 num_audio_channels);
int16_t Resample10Msec(const int16_t* in_audio,
const int32_t in_freq_hz,
int16_t* out_audio,
const int32_t out_freq_hz,
uint8_t num_audio_channels);
private:
// Use the Resampler class.

View File

@ -26,7 +26,7 @@
namespace webrtc {
#ifndef WEBRTC_CODEC_SPEEX
ACMSPEEX::ACMSPEEX(WebRtc_Word16 /* codec_id */)
ACMSPEEX::ACMSPEEX(int16_t /* codec_id */)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL),
compl_mode_(0),
@ -41,40 +41,40 @@ ACMSPEEX::~ACMSPEEX() {
return;
}
WebRtc_Word16 ACMSPEEX::InternalEncode(
WebRtc_UWord8* /* bitstream */,
WebRtc_Word16* /* bitstream_len_byte */) {
int16_t ACMSPEEX::InternalEncode(
uint8_t* /* bitstream */,
int16_t* /* bitstream_len_byte */) {
return -1;
}
WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMSPEEX::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return -1;
}
WebRtc_Word16 ACMSPEEX::EnableDTX() {
int16_t ACMSPEEX::EnableDTX() {
return -1;
}
WebRtc_Word16 ACMSPEEX::DisableDTX() {
int16_t ACMSPEEX::DisableDTX() {
return -1;
}
WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
int16_t ACMSPEEX::InternalInitEncoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word16 ACMSPEEX::InternalInitDecoder(
int16_t ACMSPEEX::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
return -1;
}
WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
int32_t ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& /* codec_def */,
const CodecInst& /* codec_inst */) {
return -1;
}
@ -82,7 +82,7 @@ ACMGenericCodec* ACMSPEEX::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMSPEEX::InternalCreateEncoder() {
int16_t ACMSPEEX::InternalCreateEncoder() {
return -1;
}
@ -90,7 +90,7 @@ void ACMSPEEX::DestructEncoderSafe() {
return;
}
WebRtc_Word16 ACMSPEEX::InternalCreateDecoder() {
int16_t ACMSPEEX::InternalCreateDecoder() {
return -1;
}
@ -98,7 +98,7 @@ void ACMSPEEX::DestructDecoderSafe() {
return;
}
WebRtc_Word16 ACMSPEEX::SetBitRateSafe(const WebRtc_Word32 /* rate */) {
int16_t ACMSPEEX::SetBitRateSafe(const int32_t /* rate */) {
return -1;
}
@ -107,22 +107,22 @@ void ACMSPEEX::InternalDestructEncoderInst(void* /* ptr_inst */) {
}
#ifdef UNUSEDSPEEX
WebRtc_Word16 ACMSPEEX::EnableVBR() {
int16_t ACMSPEEX::EnableVBR() {
return -1;
}
WebRtc_Word16 ACMSPEEX::DisableVBR() {
int16_t ACMSPEEX::DisableVBR() {
return -1;
}
WebRtc_Word16 ACMSPEEX::SetComplMode(WebRtc_Word16 mode) {
int16_t ACMSPEEX::SetComplMode(int16_t mode) {
return -1;
}
#endif
#else //===================== Actual Implementation =======================
ACMSPEEX::ACMSPEEX(WebRtc_Word16 codec_id)
ACMSPEEX::ACMSPEEX(int16_t codec_id)
: encoder_inst_ptr_(NULL),
decoder_inst_ptr_(NULL) {
codec_id_ = codec_id;
@ -165,11 +165,11 @@ ACMSPEEX::~ACMSPEEX() {
return;
}
WebRtc_Word16 ACMSPEEX::InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte) {
WebRtc_Word16 status;
WebRtc_Word16 num_encoded_samples = 0;
WebRtc_Word16 n = 0;
int16_t ACMSPEEX::InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte) {
int16_t status;
int16_t num_encoded_samples = 0;
int16_t n = 0;
while (num_encoded_samples < frame_len_smpl_) {
status = WebRtcSpeex_Encode(encoder_inst_ptr_,
@ -196,25 +196,25 @@ WebRtc_Word16 ACMSPEEX::InternalEncode(WebRtc_UWord8* bitstream,
// This frame is detected as inactive. We need send whatever
// encoded so far.
*bitstream_len_byte = WebRtcSpeex_GetBitstream(encoder_inst_ptr_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
return *bitstream_len_byte;
}
}
*bitstream_len_byte = WebRtcSpeex_GetBitstream(encoder_inst_ptr_,
(WebRtc_Word16*)bitstream);
(int16_t*)bitstream);
return *bitstream_len_byte;
}
WebRtc_Word16 ACMSPEEX::DecodeSafe(WebRtc_UWord8* /* bitstream */,
WebRtc_Word16 /* bitstream_len_byte */,
WebRtc_Word16* /* audio */,
WebRtc_Word16* /* audio_samples */,
WebRtc_Word8* /* speech_type */) {
int16_t ACMSPEEX::DecodeSafe(uint8_t* /* bitstream */,
int16_t /* bitstream_len_byte */,
int16_t* /* audio */,
int16_t* /* audio_samples */,
int8_t* /* speech_type */) {
return 0;
}
WebRtc_Word16 ACMSPEEX::EnableDTX() {
int16_t ACMSPEEX::EnableDTX() {
if (dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -234,7 +234,7 @@ WebRtc_Word16 ACMSPEEX::EnableDTX() {
return 0;
}
WebRtc_Word16 ACMSPEEX::DisableDTX() {
int16_t ACMSPEEX::DisableDTX() {
if (!dtx_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -255,7 +255,7 @@ WebRtc_Word16 ACMSPEEX::DisableDTX() {
return 0;
}
WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
int16_t ACMSPEEX::InternalInitEncoder(
WebRtcACMCodecParams* codec_params) {
// sanity check
if (encoder_inst_ptr_ == NULL) {
@ -264,7 +264,7 @@ WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
return -1;
}
WebRtc_Word16 status = SetBitRateSafe((codec_params->codecInstant).rate);
int16_t status = SetBitRateSafe((codec_params->codecInstant).rate);
status +=
(WebRtcSpeex_EncoderInit(encoder_inst_ptr_, vbr_enabled_, compl_mode_,
((codec_params->enable_dtx) ? 1 : 0)) < 0) ?
@ -279,9 +279,9 @@ WebRtc_Word16 ACMSPEEX::InternalInitEncoder(
}
}
WebRtc_Word16 ACMSPEEX::InternalInitDecoder(
int16_t ACMSPEEX::InternalInitDecoder(
WebRtcACMCodecParams* /* codec_params */) {
WebRtc_Word16 status;
int16_t status;
// sanity check
if (decoder_inst_ptr_ == NULL) {
@ -300,8 +300,8 @@ WebRtc_Word16 ACMSPEEX::InternalInitDecoder(
}
}
WebRtc_Word32 ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
int32_t ACMSPEEX::CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst) {
if (!decoder_initialized_) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, unique_id_,
"Error, Speex decoder is not initialized");
@ -340,7 +340,7 @@ ACMGenericCodec* ACMSPEEX::CreateInstance(void) {
return NULL;
}
WebRtc_Word16 ACMSPEEX::InternalCreateEncoder() {
int16_t ACMSPEEX::InternalCreateEncoder() {
return WebRtcSpeex_CreateEnc(&encoder_inst_ptr_, sampling_frequency_);
}
@ -355,7 +355,7 @@ void ACMSPEEX::DestructEncoderSafe() {
encoding_rate_ = 0;
}
WebRtc_Word16 ACMSPEEX::InternalCreateDecoder() {
int16_t ACMSPEEX::InternalCreateDecoder() {
return WebRtcSpeex_CreateDec(&decoder_inst_ptr_, sampling_frequency_, 1);
}
@ -369,7 +369,7 @@ void ACMSPEEX::DestructDecoderSafe() {
decoder_initialized_ = false;
}
WebRtc_Word16 ACMSPEEX::SetBitRateSafe(const WebRtc_Word32 rate) {
int16_t ACMSPEEX::SetBitRateSafe(const int32_t rate) {
// Check if changed rate
if (rate == encoding_rate_) {
return 0;
@ -397,7 +397,7 @@ void ACMSPEEX::InternalDestructEncoderInst(void* ptr_inst) {
// This API is currently not in use. If requested to be able to enable/disable
// VBR an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::EnableVBR() {
int16_t ACMSPEEX::EnableVBR() {
if (vbr_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -418,7 +418,7 @@ WebRtc_Word16 ACMSPEEX::EnableVBR() {
// This API is currently not in use. If requested to be able to enable/disable
// VBR an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::DisableVBR() {
int16_t ACMSPEEX::DisableVBR() {
if (!vbr_enabled_) {
return 0;
} else if (encoder_exist_) { // check if encoder exist
@ -440,7 +440,7 @@ WebRtc_Word16 ACMSPEEX::DisableVBR() {
// This API is currently not in use. If requested to be able to set complexity
// an ACM API need to be added.
WebRtc_Word16 ACMSPEEX::SetComplMode(WebRtc_Word16 mode) {
int16_t ACMSPEEX::SetComplMode(int16_t mode) {
// Check if new mode
if (mode == compl_mode_) {
return 0;

View File

@ -21,60 +21,60 @@ namespace webrtc {
class ACMSPEEX : public ACMGenericCodec {
public:
explicit ACMSPEEX(WebRtc_Word16 codec_id);
explicit ACMSPEEX(int16_t codec_id);
~ACMSPEEX();
// for FEC
ACMGenericCodec* CreateInstance(void);
WebRtc_Word16 InternalEncode(WebRtc_UWord8* bitstream,
WebRtc_Word16* bitstream_len_byte);
int16_t InternalEncode(uint8_t* bitstream,
int16_t* bitstream_len_byte);
WebRtc_Word16 InternalInitEncoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
WebRtc_Word16 InternalInitDecoder(WebRtcACMCodecParams *codec_params);
int16_t InternalInitDecoder(WebRtcACMCodecParams *codec_params);
protected:
WebRtc_Word16 DecodeSafe(WebRtc_UWord8* bitstream,
WebRtc_Word16 bitstream_len_byte,
WebRtc_Word16* audio,
WebRtc_Word16* audio_samples,
WebRtc_Word8* speech_type);
int16_t DecodeSafe(uint8_t* bitstream,
int16_t bitstream_len_byte,
int16_t* audio,
int16_t* audio_samples,
int8_t* speech_type);
WebRtc_Word32 CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
int32_t CodecDef(WebRtcNetEQ_CodecDef& codec_def,
const CodecInst& codec_inst);
void DestructEncoderSafe();
void DestructDecoderSafe();
WebRtc_Word16 InternalCreateEncoder();
int16_t InternalCreateEncoder();
WebRtc_Word16 InternalCreateDecoder();
int16_t InternalCreateDecoder();
void InternalDestructEncoderInst(void* ptr_inst);
WebRtc_Word16 SetBitRateSafe(const WebRtc_Word32 rate);
int16_t SetBitRateSafe(const int32_t rate);
WebRtc_Word16 EnableDTX();
int16_t EnableDTX();
WebRtc_Word16 DisableDTX();
int16_t DisableDTX();
#ifdef UNUSEDSPEEX
WebRtc_Word16 EnableVBR();
int16_t EnableVBR();
WebRtc_Word16 DisableVBR();
int16_t DisableVBR();
WebRtc_Word16 SetComplMode(WebRtc_Word16 mode);
int16_t SetComplMode(int16_t mode);
#endif
SPEEX_encinst_t_* encoder_inst_ptr_;
SPEEX_decinst_t_* decoder_inst_ptr_;
WebRtc_Word16 compl_mode_;
int16_t compl_mode_;
bool vbr_enabled_;
WebRtc_Word32 encoding_rate_;
WebRtc_Word16 sampling_frequency_;
WebRtc_UWord16 samples_in_20ms_audio_;
int32_t encoding_rate_;
int16_t sampling_frequency_;
uint16_t samples_in_20ms_audio_;
};
} // namespace webrtc

View File

@ -19,7 +19,7 @@
namespace webrtc {
// Create module
AudioCodingModule* AudioCodingModule::Create(const WebRtc_Word32 id) {
AudioCodingModule* AudioCodingModule::Create(const int32_t id) {
return new AudioCodingModuleImpl(id);
}
@ -29,21 +29,21 @@ void AudioCodingModule::Destroy(AudioCodingModule* module) {
}
// Get number of supported codecs
WebRtc_UWord8 AudioCodingModule::NumberOfCodecs() {
return static_cast<WebRtc_UWord8>(ACMCodecDB::kNumCodecs);
uint8_t AudioCodingModule::NumberOfCodecs() {
return static_cast<uint8_t>(ACMCodecDB::kNumCodecs);
}
// Get supported codec param with id
WebRtc_Word32 AudioCodingModule::Codec(WebRtc_UWord8 list_id,
CodecInst* codec) {
int32_t AudioCodingModule::Codec(uint8_t list_id,
CodecInst* codec) {
// Get the codec settings for the codec with the given list ID
return ACMCodecDB::Codec(list_id, codec);
}
// Get supported codec Param with name, frequency and number of channels.
WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
CodecInst* codec, int sampling_freq_hz,
int 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.
@ -70,8 +70,8 @@ WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
}
// Get supported codec Index with name, frequency and number of channels.
WebRtc_Word32 AudioCodingModule::Codec(const char* payload_name,
int sampling_freq_hz, int channels) {
int32_t AudioCodingModule::Codec(const char* payload_name,
int sampling_freq_hz, int channels) {
return ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels);
}

View File

@ -102,7 +102,7 @@ static int TimestampLessThan(uint32_t t1, uint32_t t2) {
} // namespace
AudioCodingModuleImpl::AudioCodingModuleImpl(const WebRtc_Word32 id)
AudioCodingModuleImpl::AudioCodingModuleImpl(const int32_t id)
: packetization_callback_(NULL),
id_(id),
last_timestamp_(0xD87F3F9F),
@ -170,7 +170,7 @@ AudioCodingModuleImpl::AudioCodingModuleImpl(const WebRtc_Word32 id)
neteq_.set_id(id_);
// Allocate memory for RED.
red_buffer_ = new WebRtc_UWord8[MAX_PAYLOAD_SIZE_BYTE];
red_buffer_ = new uint8_t[MAX_PAYLOAD_SIZE_BYTE];
// TODO(turajs): This might not be exactly how this class is supposed to work.
// The external usage might be that |fragmentationVectorSize| has to match
@ -270,7 +270,7 @@ AudioCodingModuleImpl::~AudioCodingModuleImpl() {
"Destroyed");
}
WebRtc_Word32 AudioCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) {
int32_t AudioCodingModuleImpl::ChangeUniqueId(const int32_t id) {
{
CriticalSectionScoped lock(acm_crit_sect_);
id_ = id;
@ -288,7 +288,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) {
// Returns the number of milliseconds until the module want a
// worker thread to call Process.
WebRtc_Word32 AudioCodingModuleImpl::TimeUntilNextProcess() {
int32_t AudioCodingModuleImpl::TimeUntilNextProcess() {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("TimeUntilNextProcess")) {
@ -298,7 +298,7 @@ WebRtc_Word32 AudioCodingModuleImpl::TimeUntilNextProcess() {
(send_codec_inst_.plfreq / 1000);
}
WebRtc_Word32 AudioCodingModuleImpl::Process() {
int32_t AudioCodingModuleImpl::Process() {
bool dual_stream;
{
CriticalSectionScoped lock(acm_crit_sect_);
@ -327,7 +327,7 @@ int AudioCodingModuleImpl::EncodeFragmentation(int fragmentation_index,
fragmentation_.fragmentationLength[fragmentation_index] = len_bytes;
fragmentation_.fragmentationPlType[fragmentation_index] = payload_type;
fragmentation_.fragmentationTimeDiff[fragmentation_index] =
static_cast<WebRtc_UWord16>(current_timestamp - rtp_timestamp);
static_cast<uint16_t>(current_timestamp - rtp_timestamp);
fragmentation_.fragmentationVectorSize++;
return len_bytes;
}
@ -448,7 +448,7 @@ int AudioCodingModuleImpl::ProcessDualStream() {
fragmentation_.fragmentationPlType[index_previous_secondary] =
secondary_send_codec_inst_.pltype;
fragmentation_.fragmentationTimeDiff[index_previous_secondary] =
static_cast<WebRtc_UWord16>(current_timestamp - last_fec_timestamp_);
static_cast<uint16_t>(current_timestamp - last_fec_timestamp_);
fragmentation_.fragmentationVectorSize++;
}
@ -512,14 +512,14 @@ int AudioCodingModuleImpl::ProcessDualStream() {
// Process any pending tasks such as timeouts.
int AudioCodingModuleImpl::ProcessSingleStream() {
// Make room for 1 RED payload.
WebRtc_UWord8 stream[2 * MAX_PAYLOAD_SIZE_BYTE];
WebRtc_Word16 length_bytes = 2 * MAX_PAYLOAD_SIZE_BYTE;
WebRtc_Word16 red_length_bytes = length_bytes;
WebRtc_UWord32 rtp_timestamp;
WebRtc_Word16 status;
uint8_t stream[2 * MAX_PAYLOAD_SIZE_BYTE];
int16_t length_bytes = 2 * MAX_PAYLOAD_SIZE_BYTE;
int16_t red_length_bytes = length_bytes;
uint32_t rtp_timestamp;
int16_t status;
WebRtcACMEncodingType encoding_type;
FrameType frame_type = kAudioFrameSpeech;
WebRtc_UWord8 current_payload_type = 0;
uint8_t current_payload_type = 0;
bool has_data_to_send = false;
bool fec_active = false;
RTPFragmentationHeader my_fragmentation;
@ -553,7 +553,7 @@ int AudioCodingModuleImpl::ProcessSingleStream() {
}
case kActiveNormalEncoded:
case kPassiveNormalEncoded: {
current_payload_type = (WebRtc_UWord8) send_codec_inst_.pltype;
current_payload_type = (uint8_t) send_codec_inst_.pltype;
frame_type = kAudioFrameSpeech;
break;
}
@ -641,7 +641,7 @@ int AudioCodingModuleImpl::ProcessSingleStream() {
fragmentation_.fragmentationLength[1]);
// Update the fragmentation time difference vector, in number of
// timestamps.
WebRtc_UWord16 time_since_last = WebRtc_UWord16(
uint16_t time_since_last = uint16_t(
rtp_timestamp - last_fec_timestamp_);
// Update fragmentation vectors.
@ -665,7 +665,7 @@ int AudioCodingModuleImpl::ProcessSingleStream() {
// RFC 2198 (RTP Payload for Redundant Audio Data) will be used.
// First fragment is the current data (new).
// Second fragment is the previous data (old).
length_bytes = static_cast<WebRtc_Word16>(
length_bytes = static_cast<int16_t>(
fragmentation_.fragmentationLength[0] +
fragmentation_.fragmentationLength[1]);
@ -714,7 +714,7 @@ int AudioCodingModuleImpl::ProcessSingleStream() {
if (vad_callback_ != NULL) {
// Callback with VAD decision.
vad_callback_->InFrameType(((WebRtc_Word16) encoding_type));
vad_callback_->InFrameType(((int16_t) encoding_type));
}
}
return length_bytes;
@ -725,7 +725,7 @@ int AudioCodingModuleImpl::ProcessSingleStream() {
//
// Initialize send codec.
WebRtc_Word32 AudioCodingModuleImpl::InitializeSender() {
int32_t AudioCodingModuleImpl::InitializeSender() {
CriticalSectionScoped lock(acm_crit_sect_);
// Start with invalid values.
@ -756,7 +756,7 @@ WebRtc_Word32 AudioCodingModuleImpl::InitializeSender() {
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::ResetEncoder() {
int32_t AudioCodingModuleImpl::ResetEncoder() {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("ResetEncoder")) {
return -1;
@ -921,7 +921,7 @@ int AudioCodingModuleImpl::SecondarySendCodec(
}
// Can be called multiple times for Codec, CNG, RED.
WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec(
int32_t AudioCodingModuleImpl::RegisterSendCodec(
const CodecInst& send_codec) {
int mirror_id;
int codec_id = IsValidSendCodec(send_codec, true, id_, &mirror_id);
@ -1038,7 +1038,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec(
}
ACMGenericCodec* codec_ptr = codecs_[codec_id];
WebRtc_Word16 status;
int16_t status;
WebRtcACMCodecParams codec_params;
memcpy(&(codec_params.codec_inst), &send_codec, sizeof(CodecInst));
@ -1171,7 +1171,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterSendCodec(
}
// Get current send codec.
WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
int32_t AudioCodingModuleImpl::SendCodec(
CodecInst* current_codec) const {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendCodec()");
@ -1193,7 +1193,7 @@ WebRtc_Word32 AudioCodingModuleImpl::SendCodec(
}
// Get current send frequency.
WebRtc_Word32 AudioCodingModuleImpl::SendFrequency() const {
int32_t AudioCodingModuleImpl::SendFrequency() const {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"SendFrequency()");
CriticalSectionScoped lock(acm_crit_sect_);
@ -1211,7 +1211,7 @@ WebRtc_Word32 AudioCodingModuleImpl::SendFrequency() const {
// Get encode bitrate.
// Adaptive rate codecs return their current encode target rate, while other
// codecs return there longterm avarage or their fixed rate.
WebRtc_Word32 AudioCodingModuleImpl::SendBitrate() const {
int32_t AudioCodingModuleImpl::SendBitrate() const {
CriticalSectionScoped lock(acm_crit_sect_);
if (!send_codec_registered_) {
@ -1229,14 +1229,14 @@ WebRtc_Word32 AudioCodingModuleImpl::SendBitrate() const {
// Set available bandwidth, inform the encoder about the estimated bandwidth
// received from the remote party.
WebRtc_Word32 AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(
const WebRtc_Word32 bw) {
int32_t AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(
const int32_t bw) {
return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
}
// Register a transport callback which will be called to deliver
// the encoded buffers.
WebRtc_Word32 AudioCodingModuleImpl::RegisterTransportCallback(
int32_t AudioCodingModuleImpl::RegisterTransportCallback(
AudioPacketizationCallback* transport) {
CriticalSectionScoped lock(callback_crit_sect_);
packetization_callback_ = transport;
@ -1245,7 +1245,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterTransportCallback(
// Used by the module to deliver messages to the codec module/application
// AVT(DTMF).
WebRtc_Word32 AudioCodingModuleImpl::RegisterIncomingMessagesCallback(
int32_t AudioCodingModuleImpl::RegisterIncomingMessagesCallback(
#ifndef WEBRTC_DTMF_DETECTION
AudioCodingFeedback* /* incoming_message */,
const ACMCountries /* cpt */) {
@ -1253,7 +1253,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterIncomingMessagesCallback(
#else
AudioCodingFeedback* incoming_message,
const ACMCountries cpt) {
WebRtc_Word16 status = 0;
int16_t status = 0;
// Enter the critical section for callback.
{
@ -1302,7 +1302,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterIncomingMessagesCallback(
}
// Add 10MS of raw (PCM) audio data to the encoder.
WebRtc_Word32 AudioCodingModuleImpl::Add10MsData(
int32_t AudioCodingModuleImpl::Add10MsData(
const AudioFrame& audio_frame) {
if (audio_frame.samples_per_channel_ <= 0) {
assert(false);
@ -1412,7 +1412,7 @@ int AudioCodingModuleImpl::PreprocessToAddData(const AudioFrame& in_frame,
assert((secondary_encoder_.get() != NULL) ?
secondary_send_codec_inst_.plfreq == send_codec_inst_.plfreq : true);
bool resample = ((WebRtc_Word32) in_frame.sample_rate_hz_
bool resample = ((int32_t) in_frame.sample_rate_hz_
!= send_codec_inst_.plfreq);
// This variable is true if primary codec and secondary codec (if exists)
@ -1465,7 +1465,7 @@ int AudioCodingModuleImpl::PreprocessToAddData(const AudioFrame& in_frame,
// Calculate the timestamp of this frame.
if (last_in_timestamp_ > in_frame.timestamp_) {
// A wrap around has happened.
timestamp_diff = ((WebRtc_UWord32) 0xFFFFFFFF - last_in_timestamp_)
timestamp_diff = ((uint32_t) 0xFFFFFFFF - last_in_timestamp_)
+ in_frame.timestamp_;
} else {
timestamp_diff = in_frame.timestamp_ - last_in_timestamp_;
@ -1502,7 +1502,7 @@ bool AudioCodingModuleImpl::FECStatus() const {
}
// Configure FEC status i.e on/off.
WebRtc_Word32
int32_t
AudioCodingModuleImpl::SetFECStatus(
#ifdef WEBRTC_CODEC_RED
const bool enable_fec) {
@ -1532,9 +1532,9 @@ AudioCodingModuleImpl::SetFECStatus(
/////////////////////////////////////////
// (VAD) Voice Activity Detection
//
WebRtc_Word32 AudioCodingModuleImpl::SetVAD(const bool enable_dtx,
const bool enable_vad,
const ACMVADMode mode) {
int32_t AudioCodingModuleImpl::SetVAD(const bool enable_dtx,
const bool enable_vad,
const ACMVADMode mode) {
CriticalSectionScoped lock(acm_crit_sect_);
return SetVADSafe(enable_dtx, enable_vad, mode);
}
@ -1569,7 +1569,7 @@ int AudioCodingModuleImpl::SetVADSafe(bool enable_dtx,
// If a send codec is registered, set VAD/DTX for the codec.
if (HaveValidEncoder("SetVAD")) {
WebRtc_Word16 status = codecs_[current_send_codec_idx_]->SetVAD(enable_dtx,
int16_t status = codecs_[current_send_codec_idx_]->SetVAD(enable_dtx,
enable_vad,
mode);
if (status == 1) {
@ -1600,8 +1600,8 @@ int AudioCodingModuleImpl::SetVADSafe(bool enable_dtx,
// Get VAD/DTX settings.
// TODO(tlegrand): Change this method to void.
WebRtc_Word32 AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled,
ACMVADMode* mode) const {
int32_t AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled,
ACMVADMode* mode) const {
CriticalSectionScoped lock(acm_crit_sect_);
*dtx_enabled = dtx_enabled_;
@ -1615,13 +1615,13 @@ WebRtc_Word32 AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled,
// Receiver
//
WebRtc_Word32 AudioCodingModuleImpl::InitializeReceiver() {
int32_t AudioCodingModuleImpl::InitializeReceiver() {
CriticalSectionScoped lock(acm_crit_sect_);
return InitializeReceiverSafe();
}
// Initialize receiver, resets codec database etc.
WebRtc_Word32 AudioCodingModuleImpl::InitializeReceiverSafe() {
int32_t AudioCodingModuleImpl::InitializeReceiverSafe() {
initial_delay_ms_ = 0;
num_packets_accumulated_ = 0;
num_bytes_accumulated_ = 0;
@ -1673,7 +1673,7 @@ WebRtc_Word32 AudioCodingModuleImpl::InitializeReceiverSafe() {
}
// Reset the decoder state.
WebRtc_Word32 AudioCodingModuleImpl::ResetDecoder() {
int32_t AudioCodingModuleImpl::ResetDecoder() {
CriticalSectionScoped lock(acm_crit_sect_);
for (int id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
@ -1689,7 +1689,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ResetDecoder() {
}
// Get current receive frequency.
WebRtc_Word32 AudioCodingModuleImpl::ReceiveFrequency() const {
int32_t AudioCodingModuleImpl::ReceiveFrequency() const {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"ReceiveFrequency()");
WebRtcACMCodecParams codec_params;
@ -1706,7 +1706,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReceiveFrequency() const {
}
// Get current playout frequency.
WebRtc_Word32 AudioCodingModuleImpl::PlayoutFrequency() const {
int32_t AudioCodingModuleImpl::PlayoutFrequency() const {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"PlayoutFrequency()");
@ -1717,7 +1717,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutFrequency() const {
// Register possible receive codecs, can be called multiple times,
// for codecs, CNG (NB, WB and SWB), DTMF, RED.
WebRtc_Word32 AudioCodingModuleImpl::RegisterReceiveCodec(
int32_t AudioCodingModuleImpl::RegisterReceiveCodec(
const CodecInst& receive_codec) {
CriticalSectionScoped lock(acm_crit_sect_);
@ -1859,9 +1859,9 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterReceiveCodec(
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe(
const CodecInst& receive_codec, WebRtc_Word16 codec_id,
WebRtc_Word16 mirror_id, ACMNetEQ::JitterBuffer jitter_buffer) {
int32_t AudioCodingModuleImpl::RegisterRecCodecMSSafe(
const CodecInst& receive_codec, int16_t codec_id,
int16_t mirror_id, ACMNetEQ::JitterBuffer jitter_buffer) {
ACMGenericCodec** codecs;
if (jitter_buffer == ACMNetEQ::kMasterJb) {
codecs = &codecs_[0];
@ -1896,7 +1896,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe(
codecs[codec_id]->SetIsMaster(jitter_buffer == ACMNetEQ::kMasterJb);
WebRtc_Word16 status = 0;
int16_t status = 0;
WebRtcACMCodecParams codec_params;
memcpy(&(codec_params.codec_inst), &receive_codec, sizeof(CodecInst));
codec_params.enable_vad = false;
@ -1933,7 +1933,7 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterRecCodecMSSafe(
}
// Get current received codec.
WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
int32_t AudioCodingModuleImpl::ReceiveCodec(
CodecInst* current_codec) const {
WebRtcACMCodecParams decoder_param;
CriticalSectionScoped lock(acm_crit_sect_);
@ -1958,9 +1958,9 @@ WebRtc_Word32 AudioCodingModuleImpl::ReceiveCodec(
}
// Incoming packet from network parsed and ready for decode.
WebRtc_Word32 AudioCodingModuleImpl::IncomingPacket(
const WebRtc_UWord8* incoming_payload,
const WebRtc_Word32 payload_length,
int32_t AudioCodingModuleImpl::IncomingPacket(
const uint8_t* incoming_payload,
const int32_t payload_length,
const WebRtcRTPHeader& rtp_info) {
WebRtcRTPHeader rtp_header;
@ -1977,7 +1977,7 @@ WebRtc_Word32 AudioCodingModuleImpl::IncomingPacket(
// and "received frequency."
CriticalSectionScoped lock(acm_crit_sect_);
WebRtc_UWord8 my_payload_type;
uint8_t my_payload_type;
// Check if this is an RED payload.
if (rtp_info.header.payloadType == receive_red_pltype_) {
@ -2037,8 +2037,8 @@ WebRtc_Word32 AudioCodingModuleImpl::IncomingPacket(
if (expected_channels_ == 2) {
if (!rtp_info.type.Audio.isCNG) {
// Create a new vector for the payload, maximum payload size.
WebRtc_Word32 length = payload_length;
WebRtc_UWord8 payload[kMaxPacketSize];
int32_t length = payload_length;
uint8_t payload[kMaxPacketSize];
assert(payload_length <= kMaxPacketSize);
memcpy(payload, incoming_payload, payload_length);
codecs_[current_receive_codec_idx_]->SplitStereoPacket(payload, &length);
@ -2133,8 +2133,8 @@ int AudioCodingModuleImpl::InitStereoSlave() {
}
// Minimum playout delay (Used for lip-sync).
WebRtc_Word32 AudioCodingModuleImpl::SetMinimumPlayoutDelay(
const WebRtc_Word32 time_ms) {
int32_t AudioCodingModuleImpl::SetMinimumPlayoutDelay(
const int32_t time_ms) {
if ((time_ms < 0) || (time_ms > 10000)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
"Delay must be in the range of 0-10000 milliseconds.");
@ -2160,7 +2160,7 @@ bool AudioCodingModuleImpl::DtmfPlayoutStatus() const {
// Configure Dtmf playout status i.e on/off playout the incoming outband
// Dtmf tone.
WebRtc_Word32 AudioCodingModuleImpl::SetDtmfPlayoutStatus(
int32_t AudioCodingModuleImpl::SetDtmfPlayoutStatus(
#ifndef WEBRTC_CODEC_AVT
const bool /* enable */) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
@ -2175,9 +2175,9 @@ WebRtc_Word32 AudioCodingModuleImpl::SetDtmfPlayoutStatus(
// Estimate the Bandwidth based on the incoming stream, needed for one way
// audio where the RTCP send the BW estimate.
// This is also done in the RTP module.
WebRtc_Word32 AudioCodingModuleImpl::DecoderEstimatedBandwidth() const {
int32_t AudioCodingModuleImpl::DecoderEstimatedBandwidth() const {
CodecInst codec;
WebRtc_Word16 codec_id = -1;
int16_t codec_id = -1;
int pltype_wb;
int pltype_swb;
@ -2212,7 +2212,7 @@ WebRtc_Word32 AudioCodingModuleImpl::DecoderEstimatedBandwidth() const {
}
// Set playout mode for: voice, fax, or streaming.
WebRtc_Word32 AudioCodingModuleImpl::SetPlayoutMode(
int32_t AudioCodingModuleImpl::SetPlayoutMode(
const AudioPlayoutMode mode) {
if ((mode != voice) && (mode != fax) && (mode != streaming) &&
(mode != off)) {
@ -2230,10 +2230,9 @@ AudioPlayoutMode AudioCodingModuleImpl::PlayoutMode() const {
// Get 10 milliseconds of raw audio data to play out.
// Automatic resample to the requested frequency.
WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
WebRtc_Word32 desired_freq_hz, AudioFrame* audio_frame) {
int32_t AudioCodingModuleImpl::PlayoutData10Ms(
int32_t desired_freq_hz, AudioFrame* audio_frame) {
TRACE_EVENT0("webrtc_voe", "ACM::PlayoutData10Ms");
bool stereo_mode;
if (GetSilence(desired_freq_hz, audio_frame))
@ -2254,11 +2253,11 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
// For stereo playout:
// Master and Slave samples are interleaved starting with Master.
const WebRtc_UWord16 receive_freq =
static_cast<WebRtc_UWord16>(audio_frame_.sample_rate_hz_);
const uint16_t receive_freq =
static_cast<uint16_t>(audio_frame_.sample_rate_hz_);
bool tone_detected = false;
WebRtc_Word16 last_detected_tone;
WebRtc_Word16 tone;
int16_t last_detected_tone;
int16_t tone;
// Limit the scope of ACM Critical section.
{
@ -2266,7 +2265,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
if ((receive_freq != desired_freq_hz) && (desired_freq_hz != -1)) {
// Resample payload_data.
WebRtc_Word16 temp_len = output_resampler_.Resample10Msec(
int16_t temp_len = output_resampler_.Resample10Msec(
audio_frame_.data_, receive_freq, audio_frame->data_,
desired_freq_hz, audio_frame_.num_channels_);
@ -2277,13 +2276,13 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
}
// Set the payload data length from the resampler.
audio_frame->samples_per_channel_ = (WebRtc_UWord16) temp_len;
audio_frame->samples_per_channel_ = (uint16_t) temp_len;
// Set the sampling frequency.
audio_frame->sample_rate_hz_ = desired_freq_hz;
} else {
memcpy(audio_frame->data_, audio_frame_.data_,
audio_frame_.samples_per_channel_ * audio_frame->num_channels_
* sizeof(WebRtc_Word16));
* sizeof(int16_t));
// Set the payload length.
audio_frame->samples_per_channel_ =
audio_frame_.samples_per_channel_;
@ -2304,7 +2303,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
tone);
} else {
// We are in 8 kHz so the master channel needs only 80 samples.
WebRtc_Word16 master_channel[80];
int16_t master_channel[80];
for (int n = 0; n < 80; n++) {
master_channel[n] = audio_frame->data_[n << 1];
}
@ -2320,7 +2319,7 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
audio_frame_.samples_per_channel_,
receive_freq, tone_detected, tone);
} else {
WebRtc_Word16 master_channel[WEBRTC_10MS_PCM_AUDIO];
int16_t master_channel[WEBRTC_10MS_PCM_AUDIO];
for (int n = 0; n < audio_frame_.samples_per_channel_; n++) {
master_channel[n] = audio_frame_.data_[n << 1];
}
@ -2348,11 +2347,11 @@ WebRtc_Word32 AudioCodingModuleImpl::PlayoutData10Ms(
if (dtmf_callback_ != NULL) {
if (tone != kACMToneEnd) {
// just a tone
dtmf_callback_->IncomingDtmf((WebRtc_UWord8) tone, false);
dtmf_callback_->IncomingDtmf((uint8_t) tone, false);
} else if ((tone == kACMToneEnd) && (last_detected_tone != kACMToneEnd)) {
// The tone is "END" and the previously detected tone is
// not "END," so call fir an end.
dtmf_callback_->IncomingDtmf((WebRtc_UWord8) last_detected_tone, true);
dtmf_callback_->IncomingDtmf((uint8_t) last_detected_tone, true);
}
}
}
@ -2375,7 +2374,7 @@ ACMVADMode AudioCodingModuleImpl::ReceiveVADMode() const {
}
// Configure VAD aggressiveness on the incoming stream.
WebRtc_Word16 AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
int16_t AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
return neteq_.SetVADMode(mode);
}
@ -2383,9 +2382,9 @@ WebRtc_Word16 AudioCodingModuleImpl::SetReceiveVADMode(const ACMVADMode mode) {
// Statistics
//
WebRtc_Word32 AudioCodingModuleImpl::NetworkStatistics(
int32_t AudioCodingModuleImpl::NetworkStatistics(
ACMNetworkStatistics* statistics) const {
WebRtc_Word32 status;
int32_t status;
status = neteq_.NetworkStatistics(statistics);
return status;
}
@ -2400,7 +2399,7 @@ void AudioCodingModuleImpl::DestructEncoderInst(void* inst) {
codecs_[current_send_codec_idx_]->DestructEncoderInst(inst);
}
WebRtc_Word16 AudioCodingModuleImpl::AudioBuffer(
int16_t AudioCodingModuleImpl::AudioBuffer(
WebRtcACMAudioBuff& buffer) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"AudioBuffer()");
@ -2411,7 +2410,7 @@ WebRtc_Word16 AudioCodingModuleImpl::AudioBuffer(
return codecs_[current_send_codec_idx_]->AudioBuffer(buffer);
}
WebRtc_Word16 AudioCodingModuleImpl::SetAudioBuffer(
int16_t AudioCodingModuleImpl::SetAudioBuffer(
WebRtcACMAudioBuff& buffer) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"SetAudioBuffer()");
@ -2421,7 +2420,7 @@ WebRtc_Word16 AudioCodingModuleImpl::SetAudioBuffer(
return codecs_[current_send_codec_idx_]->SetAudioBuffer(buffer);
}
WebRtc_UWord32 AudioCodingModuleImpl::EarliestTimestamp() const {
uint32_t AudioCodingModuleImpl::EarliestTimestamp() const {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"EarliestTimestamp()");
if (!HaveValidEncoder("EarliestTimestamp")) {
@ -2430,7 +2429,7 @@ WebRtc_UWord32 AudioCodingModuleImpl::EarliestTimestamp() const {
return codecs_[current_send_codec_idx_]->EarliestTimestamp();
}
WebRtc_Word32 AudioCodingModuleImpl::RegisterVADCallback(
int32_t AudioCodingModuleImpl::RegisterVADCallback(
ACMVADCallback* vad_callback) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceAudioCoding, id_,
"RegisterVADCallback()");
@ -2440,9 +2439,9 @@ WebRtc_Word32 AudioCodingModuleImpl::RegisterVADCallback(
}
// TODO(tlegrand): Modify this function to work for stereo, and add tests.
WebRtc_Word32 AudioCodingModuleImpl::IncomingPayload(
const WebRtc_UWord8* incoming_payload, const WebRtc_Word32 payload_length,
const WebRtc_UWord8 payload_type, const WebRtc_UWord32 timestamp) {
int32_t AudioCodingModuleImpl::IncomingPayload(
const uint8_t* incoming_payload, const int32_t payload_length,
const uint8_t payload_type, const uint32_t timestamp) {
if (payload_length < 0) {
// Log error in trace file.
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
@ -2467,8 +2466,8 @@ WebRtc_Word32 AudioCodingModuleImpl::IncomingPayload(
// Start with random numbers.
dummy_rtp_header_->header.sequenceNumber = rand();
dummy_rtp_header_->header.timestamp =
(static_cast<WebRtc_UWord32>(rand()) << 16) +
static_cast<WebRtc_UWord32>(rand());
(static_cast<uint32_t>(rand()) << 16) +
static_cast<uint32_t>(rand());
dummy_rtp_header_->type.Audio.channel = 1;
if (DecoderParamByPlType(payload_type, codec_params) < 0) {
@ -2513,11 +2512,11 @@ WebRtc_Word32 AudioCodingModuleImpl::IncomingPayload(
return 0;
}
WebRtc_Word16 AudioCodingModuleImpl::DecoderParamByPlType(
const WebRtc_UWord8 payload_type,
int16_t AudioCodingModuleImpl::DecoderParamByPlType(
const uint8_t payload_type,
WebRtcACMCodecParams& codec_params) const {
CriticalSectionScoped lock(acm_crit_sect_);
for (WebRtc_Word16 id = 0; id < ACMCodecDB::kMaxNumCodecs;
for (int16_t id = 0; id < ACMCodecDB::kMaxNumCodecs;
id++) {
if (codecs_[id] != NULL) {
if (codecs_[id]->DecoderInitialized()) {
@ -2537,17 +2536,17 @@ WebRtc_Word16 AudioCodingModuleImpl::DecoderParamByPlType(
return -1;
}
WebRtc_Word16 AudioCodingModuleImpl::DecoderListIDByPlName(
const char* name, const WebRtc_UWord16 frequency) const {
int16_t AudioCodingModuleImpl::DecoderListIDByPlName(
const char* name, const uint16_t frequency) const {
WebRtcACMCodecParams codec_params;
CriticalSectionScoped lock(acm_crit_sect_);
for (WebRtc_Word16 id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
for (int16_t id = 0; id < ACMCodecDB::kMaxNumCodecs; id++) {
if ((codecs_[id] != NULL)) {
if (codecs_[id]->DecoderInitialized()) {
assert(registered_pltypes_[id] >= 0);
assert(registered_pltypes_[id] <= 255);
codecs_[id]->DecoderParams(
&codec_params, (WebRtc_UWord8) registered_pltypes_[id]);
&codec_params, (uint8_t) registered_pltypes_[id]);
if (!STR_CASE_CMP(codec_params.codec_inst.plname, name)) {
// Check if the given sampling frequency matches.
// A zero sampling frequency means we matching the names
@ -2568,8 +2567,8 @@ WebRtc_Word16 AudioCodingModuleImpl::DecoderListIDByPlName(
return -1;
}
WebRtc_Word32 AudioCodingModuleImpl::LastEncodedTimestamp(
WebRtc_UWord32& timestamp) const {
int32_t AudioCodingModuleImpl::LastEncodedTimestamp(
uint32_t& timestamp) const {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("LastEncodedTimestamp")) {
return -1;
@ -2578,7 +2577,7 @@ WebRtc_Word32 AudioCodingModuleImpl::LastEncodedTimestamp(
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
int32_t AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
bool use_webrtc_dtx) {
CriticalSectionScoped lock(acm_crit_sect_);
@ -2589,7 +2588,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
return -1;
}
WebRtc_Word32 res = codecs_[current_send_codec_idx_]->ReplaceInternalDTX(
int32_t res = codecs_[current_send_codec_idx_]->ReplaceInternalDTX(
use_webrtc_dtx);
// Check if VAD is turned on, or if there is any error.
if (res == 1) {
@ -2604,7 +2603,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ReplaceInternalDTXWithWebRtc(
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
int32_t AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
bool* uses_webrtc_dtx) {
CriticalSectionScoped lock(acm_crit_sect_);
@ -2618,8 +2617,8 @@ WebRtc_Word32 AudioCodingModuleImpl::IsInternalDTXReplacedWithWebRtc(
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxRate(
const WebRtc_UWord32 max_bit_per_sec) {
int32_t AudioCodingModuleImpl::SetISACMaxRate(
const uint32_t max_bit_per_sec) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxRate")) {
@ -2629,8 +2628,8 @@ WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxRate(
return codecs_[current_send_codec_idx_]->SetISACMaxRate(max_bit_per_sec);
}
WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxPayloadSize(
const WebRtc_UWord16 max_size_bytes) {
int32_t AudioCodingModuleImpl::SetISACMaxPayloadSize(
const uint16_t max_size_bytes) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("SetISACMaxPayloadSize")) {
@ -2641,9 +2640,9 @@ WebRtc_Word32 AudioCodingModuleImpl::SetISACMaxPayloadSize(
max_size_bytes);
}
WebRtc_Word32 AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
const WebRtc_UWord8 frame_size_ms,
const WebRtc_UWord16 rate_bit_per_sec,
int32_t AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
const uint8_t frame_size_ms,
const uint16_t rate_bit_per_sec,
const bool enforce_frame_size) {
CriticalSectionScoped lock(acm_crit_sect_);
@ -2655,7 +2654,7 @@ WebRtc_Word32 AudioCodingModuleImpl::ConfigISACBandwidthEstimator(
frame_size_ms, rate_bit_per_sec, enforce_frame_size);
}
WebRtc_Word32 AudioCodingModuleImpl::SetBackgroundNoiseMode(
int32_t AudioCodingModuleImpl::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode) {
if ((mode < On) || (mode > Off)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
@ -2665,13 +2664,13 @@ WebRtc_Word32 AudioCodingModuleImpl::SetBackgroundNoiseMode(
return neteq_.SetBackgroundNoiseMode(mode);
}
WebRtc_Word32 AudioCodingModuleImpl::BackgroundNoiseMode(
int32_t AudioCodingModuleImpl::BackgroundNoiseMode(
ACMBackgroundNoiseMode* mode) {
return neteq_.BackgroundNoiseMode(*mode);
}
WebRtc_Word32 AudioCodingModuleImpl::PlayoutTimestamp(
WebRtc_UWord32* timestamp) {
int32_t AudioCodingModuleImpl::PlayoutTimestamp(
uint32_t* timestamp) {
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"PlayoutTimestamp()");
{
@ -2705,8 +2704,8 @@ bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
return true;
}
WebRtc_Word32 AudioCodingModuleImpl::UnregisterReceiveCodec(
const WebRtc_Word16 payload_type) {
int32_t AudioCodingModuleImpl::UnregisterReceiveCodec(
const int16_t payload_type) {
CriticalSectionScoped lock(acm_crit_sect_);
int id;
@ -2727,10 +2726,10 @@ WebRtc_Word32 AudioCodingModuleImpl::UnregisterReceiveCodec(
return UnregisterReceiveCodecSafe(id);
}
WebRtc_Word32 AudioCodingModuleImpl::UnregisterReceiveCodecSafe(
const WebRtc_Word16 codec_id) {
int32_t AudioCodingModuleImpl::UnregisterReceiveCodecSafe(
const int16_t codec_id) {
const WebRtcNetEQDecoder *neteq_decoder = ACMCodecDB::NetEQDecoders();
WebRtc_Word16 mirror_id = ACMCodecDB::MirrorID(codec_id);
int16_t mirror_id = ACMCodecDB::MirrorID(codec_id);
bool stereo_receiver = false;
if (codecs_[codec_id] != NULL) {
@ -2798,13 +2797,13 @@ WebRtc_Word32 AudioCodingModuleImpl::UnregisterReceiveCodecSafe(
return 0;
}
WebRtc_Word32 AudioCodingModuleImpl::REDPayloadISAC(
const WebRtc_Word32 isac_rate, const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload, WebRtc_Word16* length_bytes) {
int32_t AudioCodingModuleImpl::REDPayloadISAC(
const int32_t isac_rate, const int16_t isac_bw_estimate,
uint8_t* payload, int16_t* length_bytes) {
if (!HaveValidEncoder("EncodeData")) {
return -1;
}
WebRtc_Word16 status;
int16_t status;
status = codecs_[current_send_codec_idx_]->REDPayloadISAC(isac_rate,
isac_bw_estimate,
payload,
@ -2823,7 +2822,7 @@ void AudioCodingModuleImpl::ResetFragmentation(int vector_size) {
memset(fragmentation_.fragmentationPlType, 0, kMaxNumFragmentationVectors *
sizeof(fragmentation_.fragmentationPlType[0]));
fragmentation_.fragmentationVectorSize =
static_cast<WebRtc_UWord16>(vector_size);
static_cast<uint16_t>(vector_size);
}
int AudioCodingModuleImpl::SetInitialPlayoutDelay(int delay_ms) {

View File

@ -28,33 +28,33 @@ class RWLockWrapper;
class AudioCodingModuleImpl : public AudioCodingModule {
public:
// Constructor
explicit AudioCodingModuleImpl(const WebRtc_Word32 id);
explicit AudioCodingModuleImpl(const int32_t id);
// Destructor
~AudioCodingModuleImpl();
// Change the unique identifier of this object.
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
virtual int32_t ChangeUniqueId(const int32_t id);
// Returns the number of milliseconds until the module want a worker thread
// to call Process.
WebRtc_Word32 TimeUntilNextProcess();
int32_t TimeUntilNextProcess();
// Process any pending tasks such as timeouts.
WebRtc_Word32 Process();
int32_t Process();
/////////////////////////////////////////
// Sender
//
// Initialize send codec.
WebRtc_Word32 InitializeSender();
int32_t InitializeSender();
// Reset send codec.
WebRtc_Word32 ResetEncoder();
int32_t ResetEncoder();
// Can be called multiple times for Codec, CNG, RED.
WebRtc_Word32 RegisterSendCodec(const CodecInst& send_codec);
int32_t RegisterSendCodec(const CodecInst& send_codec);
// Register Secondary codec for dual-streaming. Dual-streaming is activated
// right after the secondary codec is registered.
@ -68,45 +68,45 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int SecondarySendCodec(CodecInst* secondary_codec) const;
// Get current send codec.
WebRtc_Word32 SendCodec(CodecInst* current_codec) const;
int32_t SendCodec(CodecInst* current_codec) const;
// Get current send frequency.
WebRtc_Word32 SendFrequency() const;
int32_t SendFrequency() const;
// Get encode bit-rate.
// Adaptive rate codecs return their current encode target rate, while other
// codecs return there long-term average or their fixed rate.
WebRtc_Word32 SendBitrate() const;
int32_t SendBitrate() const;
// Set available bandwidth, inform the encoder about the
// estimated bandwidth received from the remote party.
virtual WebRtc_Word32 SetReceivedEstimatedBandwidth(const WebRtc_Word32 bw);
virtual int32_t SetReceivedEstimatedBandwidth(const int32_t bw);
// Register a transport callback which will be
// called to deliver the encoded buffers.
WebRtc_Word32 RegisterTransportCallback(
int32_t RegisterTransportCallback(
AudioPacketizationCallback* transport);
// Used by the module to deliver messages to the codec module/application
// AVT(DTMF).
WebRtc_Word32 RegisterIncomingMessagesCallback(
int32_t RegisterIncomingMessagesCallback(
AudioCodingFeedback* incoming_message, const ACMCountries cpt);
// Add 10 ms of raw (PCM) audio data to the encoder.
WebRtc_Word32 Add10MsData(const AudioFrame& audio_frame);
int32_t Add10MsData(const AudioFrame& audio_frame);
// Set background noise mode for NetEQ, on, off or fade.
WebRtc_Word32 SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
int32_t SetBackgroundNoiseMode(const ACMBackgroundNoiseMode mode);
// Get current background noise mode.
WebRtc_Word32 BackgroundNoiseMode(ACMBackgroundNoiseMode* mode);
int32_t BackgroundNoiseMode(ACMBackgroundNoiseMode* mode);
/////////////////////////////////////////
// (FEC) Forward Error Correction
//
// Configure FEC status i.e on/off.
WebRtc_Word32 SetFECStatus(const bool enable_fec);
int32_t SetFECStatus(const bool enable_fec);
// Get FEC status.
bool FECStatus() const;
@ -117,62 +117,62 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// (CNG) Comfort Noise Generation
//
WebRtc_Word32 SetVAD(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
int32_t SetVAD(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode mode = VADNormal);
WebRtc_Word32 VAD(bool* dtx_enabled, bool* vad_enabled,
ACMVADMode* mode) const;
int32_t VAD(bool* dtx_enabled, bool* vad_enabled,
ACMVADMode* mode) const;
WebRtc_Word32 RegisterVADCallback(ACMVADCallback* vad_callback);
int32_t RegisterVADCallback(ACMVADCallback* vad_callback);
// Get VAD aggressiveness on the incoming stream.
ACMVADMode ReceiveVADMode() const;
// Configure VAD aggressiveness on the incoming stream.
WebRtc_Word16 SetReceiveVADMode(const ACMVADMode mode);
int16_t SetReceiveVADMode(const ACMVADMode mode);
/////////////////////////////////////////
// Receiver
//
// Initialize receiver, resets codec database etc.
WebRtc_Word32 InitializeReceiver();
int32_t InitializeReceiver();
// Reset the decoder state.
WebRtc_Word32 ResetDecoder();
int32_t ResetDecoder();
// Get current receive frequency.
WebRtc_Word32 ReceiveFrequency() const;
int32_t ReceiveFrequency() const;
// Get current playout frequency.
WebRtc_Word32 PlayoutFrequency() const;
int32_t PlayoutFrequency() const;
// Register possible receive codecs, can be called multiple times,
// for codecs, CNG, DTMF, RED.
WebRtc_Word32 RegisterReceiveCodec(const CodecInst& receive_codec);
int32_t RegisterReceiveCodec(const CodecInst& receive_codec);
// Get current received codec.
WebRtc_Word32 ReceiveCodec(CodecInst* current_codec) const;
int32_t ReceiveCodec(CodecInst* current_codec) const;
// Incoming packet from network parsed and ready for decode.
WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incoming_payload,
const WebRtc_Word32 payload_length,
const WebRtcRTPHeader& rtp_info);
int32_t IncomingPacket(const uint8_t* incoming_payload,
const int32_t payload_length,
const WebRtcRTPHeader& rtp_info);
// Incoming payloads, without rtp-info, the rtp-info will be created in ACM.
// One usage for this API is when pre-encoded files are pushed in ACM.
WebRtc_Word32 IncomingPayload(const WebRtc_UWord8* incoming_payload,
const WebRtc_Word32 payload_length,
const WebRtc_UWord8 payload_type,
const WebRtc_UWord32 timestamp = 0);
int32_t IncomingPayload(const uint8_t* incoming_payload,
const int32_t payload_length,
const uint8_t payload_type,
const uint32_t timestamp = 0);
// Minimum playout delay (used for lip-sync).
WebRtc_Word32 SetMinimumPlayoutDelay(const WebRtc_Word32 time_ms);
int32_t SetMinimumPlayoutDelay(const int32_t time_ms);
// Configure Dtmf playout status i.e on/off playout the incoming outband Dtmf
// tone.
WebRtc_Word32 SetDtmfPlayoutStatus(const bool enable);
int32_t SetDtmfPlayoutStatus(const bool enable);
// Get Dtmf playout status.
bool DtmfPlayoutStatus() const;
@ -180,81 +180,81 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// Estimate the Bandwidth based on the incoming stream, needed
// for one way audio where the RTCP send the BW estimate.
// This is also done in the RTP module .
WebRtc_Word32 DecoderEstimatedBandwidth() const;
int32_t DecoderEstimatedBandwidth() const;
// Set playout mode voice, fax.
WebRtc_Word32 SetPlayoutMode(const AudioPlayoutMode mode);
int32_t SetPlayoutMode(const AudioPlayoutMode mode);
// Get playout mode voice, fax.
AudioPlayoutMode PlayoutMode() const;
// Get playout timestamp.
WebRtc_Word32 PlayoutTimestamp(WebRtc_UWord32* timestamp);
int32_t PlayoutTimestamp(uint32_t* timestamp);
// Get 10 milliseconds of raw audio data to play out, and
// automatic resample to the requested frequency if > 0.
WebRtc_Word32 PlayoutData10Ms(WebRtc_Word32 desired_freq_hz,
AudioFrame* audio_frame);
int32_t PlayoutData10Ms(int32_t desired_freq_hz,
AudioFrame* audio_frame);
/////////////////////////////////////////
// Statistics
//
WebRtc_Word32 NetworkStatistics(ACMNetworkStatistics* statistics) const;
int32_t NetworkStatistics(ACMNetworkStatistics* statistics) const;
void DestructEncoderInst(void* inst);
WebRtc_Word16 AudioBuffer(WebRtcACMAudioBuff& buffer);
int16_t AudioBuffer(WebRtcACMAudioBuff& buffer);
// GET RED payload for iSAC. The method id called when 'this' ACM is
// the default ACM.
WebRtc_Word32 REDPayloadISAC(const WebRtc_Word32 isac_rate,
const WebRtc_Word16 isac_bw_estimate,
WebRtc_UWord8* payload,
WebRtc_Word16* length_bytes);
int32_t REDPayloadISAC(const int32_t isac_rate,
const int16_t isac_bw_estimate,
uint8_t* payload,
int16_t* length_bytes);
WebRtc_Word16 SetAudioBuffer(WebRtcACMAudioBuff& buffer);
int16_t SetAudioBuffer(WebRtcACMAudioBuff& buffer);
WebRtc_UWord32 EarliestTimestamp() const;
uint32_t EarliestTimestamp() const;
WebRtc_Word32 LastEncodedTimestamp(WebRtc_UWord32& timestamp) const;
int32_t LastEncodedTimestamp(uint32_t& timestamp) const;
WebRtc_Word32 ReplaceInternalDTXWithWebRtc(const bool use_webrtc_dtx);
int32_t ReplaceInternalDTXWithWebRtc(const bool use_webrtc_dtx);
WebRtc_Word32 IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx);
int32_t IsInternalDTXReplacedWithWebRtc(bool* uses_webrtc_dtx);
WebRtc_Word32 SetISACMaxRate(const WebRtc_UWord32 max_bit_per_sec);
int32_t SetISACMaxRate(const uint32_t max_bit_per_sec);
WebRtc_Word32 SetISACMaxPayloadSize(const WebRtc_UWord16 max_size_bytes);
int32_t SetISACMaxPayloadSize(const uint16_t max_size_bytes);
WebRtc_Word32 ConfigISACBandwidthEstimator(
const WebRtc_UWord8 frame_size_ms,
const WebRtc_UWord16 rate_bit_per_sec,
int32_t ConfigISACBandwidthEstimator(
const uint8_t frame_size_ms,
const uint16_t rate_bit_per_sec,
const bool enforce_frame_size = false);
WebRtc_Word32 UnregisterReceiveCodec(const WebRtc_Word16 payload_type);
int32_t UnregisterReceiveCodec(const int16_t payload_type);
protected:
void UnregisterSendCodec();
WebRtc_Word32 UnregisterReceiveCodecSafe(const WebRtc_Word16 id);
int32_t UnregisterReceiveCodecSafe(const int16_t id);
ACMGenericCodec* CreateCodec(const CodecInst& codec);
WebRtc_Word16 DecoderParamByPlType(const WebRtc_UWord8 payload_type,
WebRtcACMCodecParams& codec_params) const;
int16_t DecoderParamByPlType(const uint8_t payload_type,
WebRtcACMCodecParams& codec_params) const;
WebRtc_Word16 DecoderListIDByPlName(
const char* name, const WebRtc_UWord16 frequency = 0) const;
int16_t DecoderListIDByPlName(
const char* name, const uint16_t frequency = 0) const;
WebRtc_Word32 InitializeReceiverSafe();
int32_t InitializeReceiverSafe();
bool HaveValidEncoder(const char* caller_name) const;
WebRtc_Word32 RegisterRecCodecMSSafe(const CodecInst& receive_codec,
WebRtc_Word16 codec_id,
WebRtc_Word16 mirror_id,
ACMNetEQ::JitterBuffer jitter_buffer);
int32_t RegisterRecCodecMSSafe(const CodecInst& receive_codec,
int16_t codec_id,
int16_t mirror_id,
ACMNetEQ::JitterBuffer jitter_buffer);
// Set VAD/DTX status. This function does not acquire a lock, and it is
// created to be called only from inside a critical section.
@ -313,9 +313,9 @@ class AudioCodingModuleImpl : public AudioCodingModule {
bool GetSilence(int desired_sample_rate_hz, AudioFrame* frame);
AudioPacketizationCallback* packetization_callback_;
WebRtc_Word32 id_;
WebRtc_UWord32 last_timestamp_;
WebRtc_UWord32 last_in_timestamp_;
int32_t id_;
uint32_t last_timestamp_;
uint32_t last_in_timestamp_;
CodecInst send_codec_inst_;
uint8_t cng_nb_pltype_;
uint8_t cng_wb_pltype_;
@ -327,13 +327,13 @@ class AudioCodingModuleImpl : public AudioCodingModule {
ACMVADMode vad_mode_;
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs];
ACMGenericCodec* slave_codecs_[ACMCodecDB::kMaxNumCodecs];
WebRtc_Word16 mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs];
int16_t mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs];
bool stereo_receive_[ACMCodecDB::kMaxNumCodecs];
bool stereo_receive_registered_;
bool stereo_send_;
int prev_received_channel_;
int expected_channels_;
WebRtc_Word32 current_send_codec_idx_;
int32_t current_send_codec_idx_;
int current_receive_codec_idx_;
bool send_codec_registered_;
ACMResampler input_resampler_;
@ -341,7 +341,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
ACMNetEQ neteq_;
CriticalSectionWrapper* acm_crit_sect_;
ACMVADCallback* vad_callback_;
WebRtc_UWord8 last_recv_audio_codec_pltype_;
uint8_t last_recv_audio_codec_pltype_;
// RED/FEC.
bool is_first_red_;
@ -350,35 +350,35 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// as pointers and not an array. If concerned about the memory, then make a
// set-up function to allocate them only when they are going to be used, i.e.
// FEC or Dual-streaming is enabled.
WebRtc_UWord8* red_buffer_;
uint8_t* red_buffer_;
// TODO(turajs): we actually don't need |fragmentation_| as a member variable.
// It is sufficient to keep the length & payload type of previous payload in
// member variables.
RTPFragmentationHeader fragmentation_;
WebRtc_UWord32 last_fec_timestamp_;
uint32_t last_fec_timestamp_;
// If no RED is registered as receive codec this
// will have an invalid value.
WebRtc_UWord8 receive_red_pltype_;
uint8_t receive_red_pltype_;
// This is to keep track of CN instances where we can send DTMFs.
WebRtc_UWord8 previous_pltype_;
uint8_t previous_pltype_;
// This keeps track of payload types associated with codecs_[].
// We define it as signed variable and initialize with -1 to indicate
// unused elements.
WebRtc_Word16 registered_pltypes_[ACMCodecDB::kMaxNumCodecs];
int16_t registered_pltypes_[ACMCodecDB::kMaxNumCodecs];
// Used when payloads are pushed into ACM without any RTP info
// One example is when pre-encoded bit-stream is pushed from
// a file.
WebRtcRTPHeader* dummy_rtp_header_;
WebRtc_UWord16 recv_pl_frame_size_smpls_;
uint16_t recv_pl_frame_size_smpls_;
bool receiver_initialized_;
ACMDTMFDetection* dtmf_detector_;
AudioCodingFeedback* dtmf_callback_;
WebRtc_Word16 last_detected_tone_;
int16_t last_detected_tone_;
CriticalSectionWrapper* callback_crit_sect_;
AudioFrame audio_frame_;