]> git.tue.mpg.de Git - paraslash.git/commitdiff
flacdec: Fix DECODER_ABORTED handling.
authorAndre Noll <maan@systemlinux.org>
Tue, 3 Sep 2013 22:26:57 +0000 (22:26 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 27 Oct 2013 08:40:10 +0000 (09:40 +0100)
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.

flacdec_filter.c

index 01937e93f7fdbf2897e4404ffbb9e7781af392bd..bf881725165f38415267193473f56bc145dc2b5c 100644 (file)
@@ -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: