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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user