ref: 73870719a2cceb4aeb5465eb2f5ee15f1c4b58c6
parent: 606250ab7f002e287ec5153b69d11a262f3a265f
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 15 15:01:14 EST 2011
Fixes infinite loop for frame size <= 5 ms
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -67,6 +67,7 @@
/* Initialize CELT decoder */
st->celt_dec = celt_decoder_init(st->celt_dec, Fs, channels, NULL);
+ st->prev_mode = 0;
return st;
}
@@ -124,12 +125,12 @@
mode = st->prev_mode;
}
- if (mode != st->prev_mode
+ if (mode != st->prev_mode && st->prev_mode > 0
&& !(mode == MODE_SILK_ONLY && st->prev_mode == MODE_HYBRID)
&& !(mode == MODE_HYBRID && st->prev_mode == MODE_SILK_ONLY))
{
transition = 1;
- opus_decode(st, NULL, 0, pcm_transition, audiosize, 0);
+ opus_decode(st, NULL, 0, pcm_transition, IMAX(480, audiosize), 0);
}
if (audiosize > frame_size)
{