Index: webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c |
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c b/webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c |
index b8a067e0f3d5d4dfcea879e1efdd5b9d83dfb35b..dd5c353cb53e420d7b421c0edea7b7da3dbcf384 100644 |
--- a/webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c |
+++ b/webrtc/modules/audio_coding/codecs/ilbc/decode_residual.c |
@@ -16,6 +16,8 @@ |
******************************************************************/ |
+#include "decode_residual.h" |
+ |
#include <string.h> |
#include "defines.h" |
@@ -32,7 +34,7 @@ |
* frame residual decoder function (subrutine to iLBC_decode) |
*---------------------------------------------------------------*/ |
-void WebRtcIlbcfix_DecodeResidual( |
+bool WebRtcIlbcfix_DecodeResidual( |
IlbcDecoder *iLBCdec_inst, |
/* (i/o) the decoder state structure */ |
iLBC_bits *iLBC_encbits, /* (i/o) Encoded bits, which are used |
@@ -72,11 +74,11 @@ void WebRtcIlbcfix_DecodeResidual( |
/* construct decoded vector */ |
- WebRtcIlbcfix_CbConstruct( |
- &decresidual[start_pos+iLBCdec_inst->state_short_len], |
- iLBC_encbits->cb_index, iLBC_encbits->gain_index, |
- mem+CB_MEML-ST_MEM_L_TBL, |
- ST_MEM_L_TBL, diff); |
+ if (!WebRtcIlbcfix_CbConstruct( |
+ &decresidual[start_pos + iLBCdec_inst->state_short_len], |
+ iLBC_encbits->cb_index, iLBC_encbits->gain_index, |
+ mem + CB_MEML - ST_MEM_L_TBL, ST_MEM_L_TBL, diff)) |
+ return false; // Error. |
} |
else {/* put adaptive part in the beginning */ |
@@ -90,12 +92,11 @@ void WebRtcIlbcfix_DecodeResidual( |
/* construct decoded vector */ |
- WebRtcIlbcfix_CbConstruct( |
- reverseDecresidual, |
- iLBC_encbits->cb_index, iLBC_encbits->gain_index, |
- mem+CB_MEML-ST_MEM_L_TBL, |
- ST_MEM_L_TBL, diff |
- ); |
+ if (!WebRtcIlbcfix_CbConstruct(reverseDecresidual, iLBC_encbits->cb_index, |
+ iLBC_encbits->gain_index, |
+ mem + CB_MEML - ST_MEM_L_TBL, ST_MEM_L_TBL, |
+ diff)) |
+ return false; // Error. |
/* get decoded residual from reversed vector */ |
@@ -122,12 +123,12 @@ void WebRtcIlbcfix_DecodeResidual( |
for (subframe=0; subframe<Nfor; subframe++) { |
/* construct decoded vector */ |
- WebRtcIlbcfix_CbConstruct( |
- &decresidual[(iLBC_encbits->startIdx+1+subframe)*SUBL], |
- iLBC_encbits->cb_index+subcount*CB_NSTAGES, |
- iLBC_encbits->gain_index+subcount*CB_NSTAGES, |
- mem, MEM_LF_TBL, SUBL |
- ); |
+ if (!WebRtcIlbcfix_CbConstruct( |
+ &decresidual[(iLBC_encbits->startIdx + 1 + subframe) * SUBL], |
+ iLBC_encbits->cb_index + subcount * CB_NSTAGES, |
+ iLBC_encbits->gain_index + subcount * CB_NSTAGES, mem, MEM_LF_TBL, |
+ SUBL)) |
+ return false; // Error; |
/* update memory */ |
memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); |
@@ -160,12 +161,12 @@ void WebRtcIlbcfix_DecodeResidual( |
for (subframe=0; subframe<Nback; subframe++) { |
/* construct decoded vector */ |
- WebRtcIlbcfix_CbConstruct( |
- &reverseDecresidual[subframe*SUBL], |
- iLBC_encbits->cb_index+subcount*CB_NSTAGES, |
- iLBC_encbits->gain_index+subcount*CB_NSTAGES, |
- mem, MEM_LF_TBL, SUBL |
- ); |
+ if (!WebRtcIlbcfix_CbConstruct( |
+ &reverseDecresidual[subframe * SUBL], |
+ iLBC_encbits->cb_index + subcount * CB_NSTAGES, |
+ iLBC_encbits->gain_index + subcount * CB_NSTAGES, mem, MEM_LF_TBL, |
+ SUBL)) |
+ return false; // Error. |
/* update memory */ |
memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); |
@@ -179,4 +180,6 @@ void WebRtcIlbcfix_DecodeResidual( |
WebRtcSpl_MemCpyReversedOrder(decresidual+SUBL*Nback-1, |
reverseDecresidual, SUBL*Nback); |
} |
+ |
+ return true; // Success. |
} |