Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c |
| diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c |
| index 43a9e521277f347775c1e3739f2ed6e5ea0ec669..7f6087a356fc53290689efa27c9970875c18b186 100644 |
| --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c |
| +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c |
| @@ -38,7 +38,7 @@ MatrixProduct2 WebRtcIsacfix_MatrixProduct2; |
| /* This method assumes that |stream_size_bytes| is in valid range, |
| * i.e. >= 0 && <= STREAM_MAXW16_60MS |
| */ |
| -static void InitializeDecoderBitstream(int stream_size_bytes, |
| +static void InitializeDecoderBitstream(size_t stream_size_bytes, |
| Bitstr_dec* bitstream) { |
| bitstream->W_upper = 0xFFFFFFFF; |
| bitstream->streamval = 0; |
| @@ -621,20 +621,20 @@ int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst) |
| int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst, |
| const uint8_t* encoded, |
| - int32_t packet_size, |
| + size_t packet_size, |
| uint16_t rtp_seq_number, |
| uint32_t arr_ts) |
| { |
| ISACFIX_SubStruct *ISAC_inst; |
| Bitstr_dec streamdata; |
| int16_t err; |
| - const int kRequiredEncodedLenBytes = 10; |
| + const size_t kRequiredEncodedLenBytes = 10; |
| /* typecast pointer to real structure */ |
| ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; |
| /* Sanity check of packet length */ |
| - if (packet_size <= 0) { |
| + if (packet_size == 0) { |
| /* return error code if the packet length is null or less */ |
| ISAC_inst->errorcode = ISAC_EMPTY_PACKET; |
| return -1; |
| @@ -693,7 +693,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst, |
| int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, |
| const uint8_t* encoded, |
| - int32_t packet_size, |
| + size_t packet_size, |
| uint16_t rtp_seq_number, |
| uint32_t send_ts, |
| uint32_t arr_ts) |
| @@ -701,13 +701,13 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, |
| ISACFIX_SubStruct *ISAC_inst; |
| Bitstr_dec streamdata; |
| int16_t err; |
| - const int kRequiredEncodedLenBytes = 10; |
| + const size_t kRequiredEncodedLenBytes = 10; |
| /* typecast pointer to real structure */ |
| ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; |
| /* Sanity check of packet length */ |
| - if (packet_size <= 0) { |
| + if (packet_size == 0) { |
| /* return error code if the packet length is null or less */ |
| ISAC_inst->errorcode = ISAC_EMPTY_PACKET; |
| return -1; |
| @@ -770,15 +770,16 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, |
| int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
| const uint8_t* encoded, |
| - int16_t len, |
| + size_t len, |
| int16_t* decoded, |
| int16_t* speechType) |
| { |
| ISACFIX_SubStruct *ISAC_inst; |
| /* number of samples (480 or 960), output from decoder */ |
| /* that were actually used in the encoder/decoder (determined on the fly) */ |
| - int16_t number_of_samples; |
| - int declen = 0; |
| + size_t number_of_samples; |
| + int declen_int = 0; |
| + size_t declen; |
| /* typecast pointer to real structure */ |
| ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; |
| @@ -790,7 +791,7 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
| } |
| /* Sanity check of packet length */ |
| - if (len <= 0) { |
| + if (len == 0) { |
| /* return error code if the packet length is null or less */ |
| ISAC_inst->errorcode = ISAC_EMPTY_PACKET; |
| return -1; |
| @@ -807,14 +808,15 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
| /* added for NetEq purposes (VAD/DTX related) */ |
| *speechType=1; |
| - declen = WebRtcIsacfix_DecodeImpl(decoded, &ISAC_inst->ISACdec_obj, |
| - &number_of_samples); |
| - if (declen < 0) { |
| + declen_int = WebRtcIsacfix_DecodeImpl(decoded, &ISAC_inst->ISACdec_obj, |
| + &number_of_samples); |
| + if (declen_int < 0) { |
| /* Some error inside the decoder */ |
| - ISAC_inst->errorcode = -(int16_t)declen; |
| + ISAC_inst->errorcode = -(int16_t)declen_int; |
| memset(decoded, 0, sizeof(int16_t) * MAX_FRAMESAMPLES); |
| return -1; |
| } |
| + declen = (size_t)declen_int; |
| /* error check */ |
| @@ -836,7 +838,7 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
| } |
| } |
| - return number_of_samples; |
| + return (int)number_of_samples; |
| } |
| @@ -867,15 +869,16 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
| #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED |
| int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, |
| const uint16_t *encoded, |
|
minyue-webrtc
2015/08/12 16:08:08
It seems that the spacing here was not good. Would
Peter Kasting
2015/08/14 22:32:26
Done (in this file)
|
| - int16_t len, |
| + size_t len, |
| int16_t *decoded, |
| int16_t *speechType) |
| { |
| ISACFIX_SubStruct *ISAC_inst; |
| /* twice the number of samples (480 or 960), output from decoder */ |
| /* that were actually used in the encoder/decoder (determined on the fly) */ |
| - int16_t number_of_samples; |
| - int declen = 0; |
| + size_t number_of_samples; |
| + int declen_int = 0; |
| + size_t declen; |
| int16_t dummy[FRAMESAMPLES/2]; |
| @@ -888,7 +891,7 @@ int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, |
| return (-1); |
| } |
| - if (len <= 0) { |
| + if (len == 0) { |
| /* return error code if the packet length is null or less */ |
| ISAC_inst->errorcode = ISAC_EMPTY_PACKET; |
| return -1; |
| @@ -905,14 +908,15 @@ int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, |
| /* added for NetEq purposes (VAD/DTX related) */ |
| *speechType=1; |
| - declen = WebRtcIsacfix_DecodeImpl(decoded, &ISAC_inst->ISACdec_obj, |
| - &number_of_samples); |
| - if (declen < 0) { |
| + declen_int = WebRtcIsacfix_DecodeImpl(decoded,&ISAC_inst->ISACdec_obj, |
| + &number_of_samples); |
| + if (declen_int < 0) { |
| /* Some error inside the decoder */ |
| - ISAC_inst->errorcode = -(int16_t)declen; |
| + ISAC_inst->errorcode = -(int16_t)declen_int; |
| memset(decoded, 0, sizeof(int16_t) * FRAMESAMPLES); |
| return -1; |
| } |
| + declen = (size_t)declen_int; |
| /* error check */ |
| @@ -941,7 +945,7 @@ int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, |
| dummy, &ISAC_inst->ISACdec_obj.decimatorstr_obj); |
| } |
| - return number_of_samples/2; |
| + return (int)(number_of_samples / 2); |
| } |
| #endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */ |
| @@ -962,16 +966,15 @@ int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, |
| * Output: |
| * - decoded : The decoded vector |
| * |
| - * Return value : >0 - number of samples in decoded PLC vector |
| - * -1 - Error |
| + * Return value : Number of samples in decoded PLC vector |
| */ |
| #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED |
| -int16_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, |
| - int16_t *decoded, |
| - int16_t noOfLostFrames ) |
| +size_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, |
| + int16_t *decoded, |
| + size_t noOfLostFrames ) |
| { |
| - int16_t no_of_samples, declen, k, ok; |
| + size_t no_of_samples, declen, k; |
| int16_t outframeNB[FRAMESAMPLES]; |
| int16_t outframeWB[FRAMESAMPLES]; |
| int16_t dummy[FRAMESAMPLES/2]; |
| @@ -1028,16 +1031,15 @@ int16_t WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, |
| * Output: |
| * - decoded : The decoded vector |
| * |
| - * Return value : >0 - number of samples in decoded PLC vector |
| - * -1 - Error |
| + * Return value : Number of samples in decoded PLC vector |
| */ |
| -int16_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst, |
| - int16_t *decoded, |
| - int16_t noOfLostFrames) |
| +size_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst, |
| + int16_t *decoded, |
| + size_t noOfLostFrames) |
| { |
| - int16_t no_of_samples, declen, k; |
| + size_t no_of_samples, declen, k; |
| int16_t outframe16[MAX_FRAMESAMPLES]; |
| ISACFIX_SubStruct *ISAC_inst; |
| @@ -1272,12 +1274,12 @@ int16_t WebRtcIsacfix_UpdateUplinkBw(ISACFIX_MainStruct* ISAC_main_inst, |
| */ |
| int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded, |
| - int encoded_len_bytes, |
| - int16_t* frameLength) |
| + size_t encoded_len_bytes, |
| + size_t* frameLength) |
| { |
| Bitstr_dec streamdata; |
| int16_t err; |
| - const int kRequiredEncodedLenBytes = 10; |
| + const size_t kRequiredEncodedLenBytes = 10; |
| if (encoded_len_bytes < kRequiredEncodedLenBytes) { |
| return -1; |
| @@ -1311,12 +1313,12 @@ int16_t WebRtcIsacfix_ReadFrameLen(const uint8_t* encoded, |
| */ |
| int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded, |
| - int encoded_len_bytes, |
| + size_t encoded_len_bytes, |
| int16_t* rateIndex) |
| { |
| Bitstr_dec streamdata; |
| int16_t err; |
| - const int kRequiredEncodedLenBytes = 10; |
| + const size_t kRequiredEncodedLenBytes = 10; |
| if (encoded_len_bytes < kRequiredEncodedLenBytes) { |
| return -1; |
| @@ -1327,8 +1329,8 @@ int16_t WebRtcIsacfix_ReadBwIndex(const uint8_t* encoded, |
| read_be16(encoded, kRequiredEncodedLenBytes, streamdata.stream); |
| /* decode frame length, needed to get to the rateIndex in the bitstream */ |
| - int16_t frameLength; |
| - err = WebRtcIsacfix_DecodeFrameLen(&streamdata, &frameLength); |
| + size_t framelength; |
| + err = WebRtcIsacfix_DecodeFrameLen(&streamdata, &framelength); |
| if (err<0) // error check |
| return err; |