para_filter: Decode also small ogg vorbis files properly.
authorAndre Noll <maan@systemlinux.org>
Thu, 13 Oct 2011 14:10:11 +0000 (16:10 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 13 Oct 2011 15:11:40 +0000 (17:11 +0200)
ogg_post_select() returns after initializing the decoder without
decoding anything, which is usually OK. However, if the file is smaller
than half of the size of the stdin buffer tree area, the whole file
is going to be fed to the decoder during the first iteration of the
scheduler loop. Currently this results in an empty output file.

The problem with small files is that the post select function of the
stdin buffer tree node encounters EOF on the next read and returns
EOF. This causes oggdec_post_select() to abort without producing any
output since its parent (stdin) is gone and there is no input pending.

This patch fixes the problem by setting the "have_more" flag after
ogg_init() returned successfully. oggdec_post_select() checks this
flag and only returns negative if it is unset.

oggdec_filter.c

index 32ffdef97462a9bf3a3509a25b865f69ed8fe8c5..07e4cec1c1d6ac99fcc482beedf77914d1d157b7 100644 (file)
@@ -175,6 +175,7 @@ out:
                pod->converted = 0;
                fn->min_iqs = 0;
                pod->vf = vf;
+               pod->have_more = true;
        }
        return ret;
 }