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.
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);