Index: webrtc/modules/audio_coding/codecs/ilbc/ilbc.c |
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c b/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c |
index 6cd9a723fdbb5398508bacc006e31ad56c1313e2..6587e4f3f7a4933c457a897723333ac35c566467 100644 |
--- a/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c |
+++ b/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c |
@@ -22,6 +22,7 @@ |
#include "encode.h" |
#include "init_decode.h" |
#include "decode.h" |
+#include "webrtc/base/checks.h" |
#include <stdlib.h> |
int16_t WebRtcIlbcfix_EncoderAssign(IlbcEncoderInstance** iLBC_encinst, |
@@ -180,11 +181,12 @@ int WebRtcIlbcfix_Decode(IlbcDecoderInstance* iLBCdec_inst, |
} |
while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
- WebRtcIlbcfix_DecodeImpl( |
- &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
- (const uint16_t*)&encoded |
- [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
- (IlbcDecoder*)iLBCdec_inst, 1); |
+ if (WebRtcIlbcfix_DecodeImpl( |
+ &decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
+ (const uint16_t*)&encoded |
+ [2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
+ (IlbcDecoder*)iLBCdec_inst, 1) == -1) |
+ return -1; |
i++; |
} |
/* iLBC does not support VAD/CNG yet */ |
@@ -208,11 +210,12 @@ int WebRtcIlbcfix_Decode20Ms(IlbcDecoderInstance* iLBCdec_inst, |
} |
while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
- WebRtcIlbcfix_DecodeImpl( |
+ if (!WebRtcIlbcfix_DecodeImpl( |
&decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
(const uint16_t*)&encoded |
[2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
- (IlbcDecoder*)iLBCdec_inst, 1); |
+ (IlbcDecoder*)iLBCdec_inst, 1)) |
+ return -1; |
i++; |
} |
/* iLBC does not support VAD/CNG yet */ |
@@ -236,11 +239,12 @@ int WebRtcIlbcfix_Decode30Ms(IlbcDecoderInstance* iLBCdec_inst, |
} |
while ((i*((IlbcDecoder*)iLBCdec_inst)->no_of_bytes)<len) { |
- WebRtcIlbcfix_DecodeImpl( |
+ if (!WebRtcIlbcfix_DecodeImpl( |
&decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], |
(const uint16_t*)&encoded |
[2 * i * ((IlbcDecoder*)iLBCdec_inst)->no_of_words], |
- (IlbcDecoder*)iLBCdec_inst, 1); |
+ (IlbcDecoder*)iLBCdec_inst, 1)) |
+ return -1; |
i++; |
} |
/* iLBC does not support VAD/CNG yet */ |
@@ -255,10 +259,11 @@ size_t WebRtcIlbcfix_DecodePlc(IlbcDecoderInstance* iLBCdec_inst, |
uint16_t dummy; |
for (i=0;i<noOfLostFrames;i++) { |
- /* call decoder */ |
- WebRtcIlbcfix_DecodeImpl( |
+ // PLC decoding shouldn't fail, because there is no external input data |
+ // that can be bad. |
+ RTC_CHECK(WebRtcIlbcfix_DecodeImpl( |
&decoded[i * ((IlbcDecoder*)iLBCdec_inst)->blockl], &dummy, |
- (IlbcDecoder*)iLBCdec_inst, 0); |
+ (IlbcDecoder*)iLBCdec_inst, 0)); |
} |
return (noOfLostFrames*((IlbcDecoder*)iLBCdec_inst)->blockl); |
} |