[FFmpeg-devel] [PATCH] avformat/oggdec: only parse headers before data

Chris Cunningham chcunningham at chromium.org
Tue Jun 18 03:59:40 EEST 2019

This behavior was added in 2010 to suport some old (and invalid) ogm
files. https://github.com/FFmpeg/FFmpeg/commit/81b743eb1026547270b88ac6a5cb451a3907ee94

But this makes it possible to change the codec in the later headers,
causing codec to be out of sync with internal avctx (eventually
triggering Abrt). Updating the internal ctx for this degenerate case
was deemed not worth it. See discussion here:
 libavformat/oggdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index e815f42134..19d77f3107 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -545,7 +545,7 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
     ogg->curidx    = idx;
     os->incomplete = 0;
-    if (os->header) {
+    if (!ogg->headers) {
         if ((ret = os->codec->header(s, idx)) < 0) {
             av_log(s, AV_LOG_ERROR, "Header processing failed: %s\n", av_err2str(ret));
             return ret;

More information about the ffmpeg-devel mailing list