ref: 4f1b7dac7e3b1ed0c9acce9c208c8c972f3d95d4
parent: e2a6aaa73158d4e9415a7e053f84f83314e2d9e3
author: Jean-Marc Valin <[email protected]>
date: Wed Oct 12 11:09:13 EDT 2011
Fixes a case where PLC was called on the side when no side was ever coded
--- a/silk/dec_API.c
+++ b/silk/dec_API.c
@@ -229,7 +229,7 @@
/* Call decoder for one frame */
for( n = 0; n < decControl->nChannelsInternal; n++ ) {
- if( n == 0 || decode_only_middle == 0 ) {
+ if( n == 0 || ( ( lostFlag != FLAG_PACKET_LOST ? decode_only_middle : psDec->prev_decode_only_middle ) == 0 ) ) {
ret += silk_decode_frame( &channel_state[ n ], psRangeDec, &samplesOut1_tmp[ n ][ 2 + delay ], &nSamplesOutDec, lostFlag );
} else {
silk_memset( &samplesOut1_tmp[ n ][ 2 + delay ], 0, nSamplesOutDec * sizeof( opus_int16 ) );
@@ -285,8 +285,9 @@
decControl->prevPitchLag = 0;
}
- psDec->prev_decode_only_middle = decode_only_middle;
-
+ if ( lostFlag != FLAG_PACKET_LOST ) {
+ psDec->prev_decode_only_middle = decode_only_middle;
+ }
return ret;
}