From adb03e8d53e26d4846406585ef5ad272e9b69f6e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 24 Feb 2011 14:11:18 +0100 Subject: [PATCH 1/1] 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. --- ogg_afh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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); -- 2.39.2