diff --git a/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h b/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h index b016f4017..1ec5d67d1 100644 --- a/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h +++ b/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h @@ -68,8 +68,8 @@ int16_t WebRtcCng_CreateDec(CNG_dec_inst** cng_inst); * -1 - Error */ -int16_t WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, uint16_t fs, int16_t interval, - int16_t quality); +int WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, int fs, int16_t interval, + int16_t quality); int16_t WebRtcCng_InitDec(CNG_dec_inst* cng_inst); /**************************************************************************** @@ -103,9 +103,9 @@ int16_t WebRtcCng_FreeDec(CNG_dec_inst* cng_inst); * Return value : 0 - Ok * -1 - Error */ -int16_t WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech, - int16_t nrOfSamples, uint8_t* SIDdata, - int16_t* bytesOut, int16_t forceSID); +int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech, + int16_t nrOfSamples, uint8_t* SIDdata, + int16_t* bytesOut, int16_t forceSID); /**************************************************************************** * WebRtcCng_UpdateSid(...) diff --git a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c index cb7aa4567..1f6974a45 100644 --- a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c +++ b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c @@ -36,7 +36,7 @@ typedef struct WebRtcCngDecoder_ { typedef struct WebRtcCngEncoder_ { int16_t enc_nrOfCoefs; - uint16_t enc_sampfreq; + int enc_sampfreq; int16_t enc_interval; int16_t enc_msSinceSID; int32_t enc_Energy; @@ -142,8 +142,8 @@ int16_t WebRtcCng_CreateDec(CNG_dec_inst** cng_inst) { * Return value : 0 - Ok * -1 - Error */ -int16_t WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, uint16_t fs, int16_t interval, - int16_t quality) { +int WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, int fs, int16_t interval, + int16_t quality) { int i; WebRtcCngEncoder* inst = (WebRtcCngEncoder*) cng_inst; memset(inst, 0, sizeof(WebRtcCngEncoder)); @@ -227,9 +227,9 @@ int16_t WebRtcCng_FreeDec(CNG_dec_inst* cng_inst) { * Return value : 0 - Ok * -1 - Error */ -int16_t WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech, - int16_t nrOfSamples, uint8_t* SIDdata, - int16_t* bytesOut, int16_t forceSID) { +int WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech, + int16_t nrOfSamples, uint8_t* SIDdata, + int16_t* bytesOut, int16_t forceSID) { WebRtcCngEncoder* inst = (WebRtcCngEncoder*) cng_inst; int16_t arCoefs[WEBRTC_CNG_MAX_LPC_ORDER + 1]; @@ -388,10 +388,12 @@ int16_t WebRtcCng_Encode(CNG_enc_inst* cng_inst, int16_t* speech, inst->enc_msSinceSID = 0; *bytesOut = inst->enc_nrOfCoefs + 1; - inst->enc_msSinceSID += (1000 * nrOfSamples) / inst->enc_sampfreq; + inst->enc_msSinceSID += + (int16_t)((1000 * nrOfSamples) / inst->enc_sampfreq); return inst->enc_nrOfCoefs + 1; } else { - inst->enc_msSinceSID += (1000 * nrOfSamples) / inst->enc_sampfreq; + inst->enc_msSinceSID += + (int16_t)((1000 * nrOfSamples) / inst->enc_sampfreq); *bytesOut = 0; return 0; } diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c index 25d75ee6e..1edf58dc1 100644 --- a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c +++ b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c @@ -39,7 +39,7 @@ int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst) } } -int16_t WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst) +int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst) { // Free encoder memory return WebRtc_g722_encode_release((G722EncoderState*) G722enc_inst); @@ -79,7 +79,7 @@ int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst) } } -int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst) +int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst) { // Free encoder memory return WebRtc_g722_decode_release((G722DecoderState*) G722dec_inst); diff --git a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h index 711b991d9..46ff3b0f0 100644 --- a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h +++ b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h @@ -73,7 +73,7 @@ int16_t WebRtcG722_EncoderInit(G722EncInst *G722enc_inst); * Return value : 0 - Ok * -1 - Error */ -int16_t WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst); +int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst); @@ -142,7 +142,7 @@ int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst); * -1 - Error */ -int16_t WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst); +int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst); /**************************************************************************** diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc index 17fa5b24b..328698380 100644 --- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc +++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc @@ -198,7 +198,7 @@ AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeInternal( CHECK_EQ(input_buffer_.size(), static_cast(num_10ms_frames_per_packet_) * samples_per_10ms_frame_); - int16_t status = WebRtcOpus_Encode( + int status = WebRtcOpus_Encode( inst_, &input_buffer_[0], rtc::CheckedDivExact(CastInt16(input_buffer_.size()), static_cast(num_channels_)), diff --git a/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h b/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h index dccc7ca71..925cd85df 100644 --- a/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h +++ b/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h @@ -64,11 +64,11 @@ int16_t WebRtcOpus_EncoderFree(OpusEncInst* inst); * Return value : >=0 - Length (in bytes) of coded data * -1 - Error */ -int16_t WebRtcOpus_Encode(OpusEncInst* inst, - const int16_t* audio_in, - int16_t samples, - int16_t length_encoded_buffer, - uint8_t* encoded); +int WebRtcOpus_Encode(OpusEncInst* inst, + const int16_t* audio_in, + int16_t samples, + int16_t length_encoded_buffer, + uint8_t* encoded); /**************************************************************************** * WebRtcOpus_SetBitRate(...) @@ -236,9 +236,9 @@ int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst); * Return value : >0 - Samples per channel in decoded vector * -1 - Error */ -int16_t WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, - int16_t encoded_bytes, int16_t* decoded, - int16_t* audio_type); +int WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, + int16_t encoded_bytes, int16_t* decoded, + int16_t* audio_type); /**************************************************************************** * WebRtcOpus_DecodePlc(...) @@ -254,8 +254,8 @@ int16_t WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, * Return value : >0 - number of samples in decoded PLC vector * -1 - Error */ -int16_t WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, - int16_t number_of_lost_frames); +int WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, + int number_of_lost_frames); /**************************************************************************** * WebRtcOpus_DecodeFec(...) @@ -275,9 +275,9 @@ int16_t WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, * 0 - No FEC data in the packet * -1 - Error */ -int16_t WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded, - int16_t encoded_bytes, int16_t* decoded, - int16_t* audio_type); +int WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded, + int16_t encoded_bytes, int16_t* decoded, + int16_t* audio_type); /**************************************************************************** * WebRtcOpus_DurationEst(...) diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_fec_test.cc b/webrtc/modules/audio_coding/codecs/opus/opus_fec_test.cc index aaaced16d..f0ef70a3b 100644 --- a/webrtc/modules/audio_coding/codecs/opus/opus_fec_test.cc +++ b/webrtc/modules/audio_coding/codecs/opus/opus_fec_test.cc @@ -131,10 +131,10 @@ OpusFecTest::OpusFecTest() } void OpusFecTest::EncodeABlock() { - int16_t value = WebRtcOpus_Encode(opus_encoder_, - &in_data_[data_pointer_], - block_length_sample_, - max_bytes_, &bit_stream_[0]); + int value = WebRtcOpus_Encode(opus_encoder_, + &in_data_[data_pointer_], + block_length_sample_, + max_bytes_, &bit_stream_[0]); EXPECT_GT(value, 0); encoded_bytes_ = value; @@ -142,7 +142,7 @@ void OpusFecTest::EncodeABlock() { void OpusFecTest::DecodeABlock(bool lost_previous, bool lost_current) { int16_t audio_type; - int16_t value_1 = 0, value_2 = 0; + int value_1 = 0, value_2 = 0; if (lost_previous) { // Decode previous frame. diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c index 527de1013..e2506166a 100644 --- a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c +++ b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c @@ -78,11 +78,11 @@ int16_t WebRtcOpus_EncoderFree(OpusEncInst* inst) { } } -int16_t WebRtcOpus_Encode(OpusEncInst* inst, - const int16_t* audio_in, - int16_t samples, - int16_t length_encoded_buffer, - uint8_t* encoded) { +int WebRtcOpus_Encode(OpusEncInst* inst, + const int16_t* audio_in, + int16_t samples, + int16_t length_encoded_buffer, + uint8_t* encoded) { int res; if (samples > 48 * kWebRtcOpusMaxEncodeFrameSizeMs) { @@ -291,9 +291,9 @@ static int DecodeNative(OpusDecInst* inst, const uint8_t* encoded, return res; } -int16_t WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, - int16_t encoded_bytes, int16_t* decoded, - int16_t* audio_type) { +int WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, + int16_t encoded_bytes, int16_t* decoded, + int16_t* audio_type) { int decoded_samples; if (encoded_bytes == 0) { @@ -318,8 +318,8 @@ int16_t WebRtcOpus_Decode(OpusDecInst* inst, const uint8_t* encoded, return decoded_samples; } -int16_t WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, - int16_t number_of_lost_frames) { +int WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, + int number_of_lost_frames) { int16_t audio_type = 0; int decoded_samples; int plc_samples; @@ -339,9 +339,9 @@ int16_t WebRtcOpus_DecodePlc(OpusDecInst* inst, int16_t* decoded, return decoded_samples; } -int16_t WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded, - int16_t encoded_bytes, int16_t* decoded, - int16_t* audio_type) { +int WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded, + int16_t encoded_bytes, int16_t* decoded, + int16_t* audio_type) { int decoded_samples; int fec_samples; diff --git a/webrtc/modules/audio_coding/main/test/opus_test.cc b/webrtc/modules/audio_coding/main/test/opus_test.cc index a407fc5d3..c61d25ad1 100644 --- a/webrtc/modules/audio_coding/main/test/opus_test.cc +++ b/webrtc/modules/audio_coding/main/test/opus_test.cc @@ -273,17 +273,11 @@ void OpusTest::Run(TestPackStereo* channel, int channels, int bitrate, int16_t bitstream_len_byte; uint8_t bitstream[kMaxBytes]; for (int i = 0; i < loop_encode; i++) { - if (channels == 1) { - bitstream_len_byte = WebRtcOpus_Encode( - opus_mono_encoder_, &audio[read_samples], - frame_length, kMaxBytes, bitstream); - ASSERT_GE(bitstream_len_byte, 0); - } else { - bitstream_len_byte = WebRtcOpus_Encode( - opus_stereo_encoder_, &audio[read_samples], - frame_length, kMaxBytes, bitstream); - ASSERT_GE(bitstream_len_byte, 0); - } + int bitstream_len_byte_int = WebRtcOpus_Encode( + (channels == 1) ? opus_mono_encoder_ : opus_stereo_encoder_, + &audio[read_samples], frame_length, kMaxBytes, bitstream); + ASSERT_GE(bitstream_len_byte_int, 0); + bitstream_len_byte = static_cast(bitstream_len_byte_int); // Simulate packet loss by setting |packet_loss_| to "true" in // |percent_loss| percent of the loops.