iLBC: Handle a case of bad input data
We detect an unreasonable state (caused by a bad encoded stream) before it can lead to problems, and handle it by resetting the decoder. NOPRESUBMIT=true BUG=chromium:617124 Review-Url: https://codereview.webrtc.org/2255203002 Cr-Commit-Position: refs/heads/master@{#13888}
This commit is contained in:
@ -16,6 +16,8 @@
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "cb_construct.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "gain_dequant.h"
|
||||
#include "get_cd_vec.h"
|
||||
@ -24,7 +26,7 @@
|
||||
* Construct decoded vector from codebook and gains.
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
void WebRtcIlbcfix_CbConstruct(
|
||||
bool WebRtcIlbcfix_CbConstruct(
|
||||
int16_t *decvector, /* (o) Decoded vector */
|
||||
int16_t *index, /* (i) Codebook indices */
|
||||
int16_t *gain_index, /* (i) Gain quantization indices */
|
||||
@ -50,9 +52,12 @@ void WebRtcIlbcfix_CbConstruct(
|
||||
/* codebook vector construction and construction of total vector */
|
||||
|
||||
/* Stack based */
|
||||
WebRtcIlbcfix_GetCbVec(cbvec0, mem, (size_t)index[0], lMem, veclen);
|
||||
WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen);
|
||||
WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen);
|
||||
if (!WebRtcIlbcfix_GetCbVec(cbvec0, mem, (size_t)index[0], lMem, veclen))
|
||||
return false; // Failure.
|
||||
if (!WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen))
|
||||
return false; // Failure.
|
||||
if (!WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen))
|
||||
return false; // Failure.
|
||||
|
||||
gainPtr = &gain[0];
|
||||
for (j=0;j<veclen;j++) {
|
||||
@ -63,5 +68,5 @@ void WebRtcIlbcfix_CbConstruct(
|
||||
decvector[j] = (int16_t)((a32 + 8192) >> 14);
|
||||
}
|
||||
|
||||
return;
|
||||
return true; // Success.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user