diff --git a/src/audiofilters/msg722.c b/src/audiofilters/msg722.c index adc88c146..cca5454de 100644 --- a/src/audiofilters/msg722.c +++ b/src/audiofilters/msg722.c @@ -267,7 +267,7 @@ static void dec_process(MSFilter *f) { /* introduce delay (TRANSITION_DELAY ms) */ generic_plc_update_continuity_buffer(s->plc_context, om->b_wptr, declen*sizeof(int16_t)); - if (s->plc_context->plc_samples_used!=0) { + if (s->plc_context->plc_samples_used!=0 && declen >= 2*16*TRANSITION_DELAY) { /* we were doing PLC, now resuming with normal audio, continuity buffer is twice the transition delay lengths, * the second half is untouched by the update function and contains transition data generated by PLC */ generic_plc_transition_mix(((int16_t *)(om->b_wptr))+16*TRANSITION_DELAY, ((int16_t *)(s->plc_context->continuity_buffer))+16*TRANSITION_DELAY, 16*TRANSITION_DELAY);