]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
vorbis: Write out _all_ pending ogg pages.
authorAndre Noll <maan@systemlinux.org>
Thu, 24 Feb 2011 13:11:18 +0000 (14:11 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 24 Feb 2011 15:15:04 +0000 (16:15 +0100)
ogg_stream_flush() does not necessarily write out all pending ogg
packets into a single ogg page. So we have to call this function
in a loop until it returns zero to make sure we have a complete
ogg/vorbis header.

This fixes a bug in the vorbis dummy header patch set which caused
corrupt replacement headers for ogg files whose header spanned more
than one ogg page.

ogg_afh.c

index 2837db61c7de43a732564c8d46fec14ef6b4331e..144a2690bf80da24d298ab2bb56c5403835157dc 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -129,10 +129,8 @@ static int vorbis_get_header_callback(ogg_packet *packet, int packet_num,
        ret = -E_OGG_PACKET_IN;
        if (ogg_stream_packetin(&vghd->os, packet) < 0)
                goto out;
-       ret = -E_OGG_STREAM_FLUSH;
-       if (ogg_stream_flush(&vghd->os, &og) == 0)
-               goto out;
-       add_ogg_page(&og, vghd);
+       while (ogg_stream_flush(&vghd->os, &og))
+               add_ogg_page(&og, vghd);
        ret = 0;
 out:
        ogg_stream_clear(&vghd->os);