From: Andre Noll Date: Thu, 24 Feb 2011 13:11:18 +0000 (+0100) Subject: vorbis: Write out _all_ pending ogg pages. X-Git-Tag: v0.4.6~19^2 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;ds=sidebyside;h=adb03e8d53e26d4846406585ef5ad272e9b69f6e;hp=f0c195e0ee6baefae0046db0e10df2e45f72ca41;p=paraslash.git vorbis: Write out _all_ pending ogg pages. 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. --- diff --git a/ogg_afh.c b/ogg_afh.c index 2837db61..144a2690 100644 --- 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);