From: Andre Noll Date: Tue, 3 Sep 2013 22:26:57 +0000 (+0000) Subject: flacdec: Fix DECODER_ABORTED handling. X-Git-Tag: v0.5.1~4^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=6da1cac0d9094a0f1869c95f0a65bc49b17544f6 flacdec: Fix DECODER_ABORTED handling. If the flac read callback is called with too little data available in the input queue to decode a single frame, we abort the decoder and call FLAC__stream_decoder_flush() afterwards. This discards the partially submitted frame so we must feed these data again when more input is available. However, we currently miss to do so, resulting in all sorts of flac errors. This patch sets ->unconsumed to zero which fixes the bug. --- diff --git a/flacdec_filter.c b/flacdec_filter.c index 01937e93..bf881725 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -258,10 +258,12 @@ static int flacdec_post_select(__a_unused struct sched *s, struct task *t) goto out; if (state == FLAC__STREAM_DECODER_ABORTED) { FLAC__stream_decoder_flush(pfd->decoder); - fn->min_iqs = pfd->unconsumed + 1; + pfd->unconsumed = 0; /* feed unconsumed bytes again */ + fn->min_iqs = btr_get_input_queue_size(btrn) + 1; ret = 1; goto out; } + pfd->have_more = true; fn->min_iqs = 0; ret = 1; out: