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 ba055ebdf53c9fcab9f2e1f3c80ad5c0c4794f28..76ac10dc52bc540688e97eb37982893c3b5ab714 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; |
@@ -616,20 +616,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; |
@@ -688,7 +688,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) |
@@ -696,13 +696,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; |
@@ -765,15 +765,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; |
@@ -785,7 +786,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; |
@@ -802,14 +803,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 */ |
@@ -831,7 +833,7 @@ int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, |
} |
} |
- return number_of_samples; |
+ return (int)number_of_samples; |
} |
@@ -860,17 +862,18 @@ 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, |
- int16_t len, |
- int16_t *decoded, |
- int16_t *speechType) |
+int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct* ISAC_main_inst, |
+ const uint16_t* encoded, |
+ 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]; |
@@ -883,7 +886,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; |
@@ -900,14 +903,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 */ |
@@ -936,7 +940,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 */ |
@@ -957,16 +961,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]; |
@@ -1023,16 +1026,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; |
@@ -1267,12 +1269,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; |
@@ -1306,12 +1308,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; |
@@ -1322,8 +1324,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; |