Otherwise the decoder will throw "Missing header" errors when the
packets are sent for decoding.
From 05f5e837862a958fb8791668ab3cdf8fc7766fe5 Mon Sep 17 00:00:00 2001
From: Dale Curtis <dalecur...@chromium.org>
Date: Mon, 29 Jan 2018 15:10:26 -0800
Subject: [PATCH] [mp3] Skip APE tags when parsing mp3 packets.

Otherwise the decoder will throw "Missing header" errors when the
packets are sent for decoding.
---
 libavcodec/mpegaudio_parser.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 8c39825792..244281b56f 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -23,6 +23,7 @@
 #include "parser.h"
 #include "mpegaudiodecheader.h"
 #include "libavutil/common.h"
+#include "libavformat/apetag.h" // for APE tag.
 #include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
 
 typedef struct MpegAudioParseContext {
@@ -120,6 +121,12 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
         return next;
     }
 
+    if (flush && buf_size >= APE_TAG_FOOTER_BYTES && memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) {
+        *poutbuf = NULL;
+        *poutbuf_size = 0;
+        return next;
+    }
+
     *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
-- 
2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to