[FFmpeg-cvslog] avformat/aacdec: resync to the next adts frame on invalid data instead of aborting

James Almer git at videolan.org
Tue Jul 23 07:15:42 EEST 2019


ffmpeg | branch: release/3.4 | James Almer <jamrial at gmail.com> | Sat Jul 20 21:47:55 2019 -0300| [bb22b9ce211c934db628a4ab1669d436864753e3] | committer: James Almer

avformat/aacdec: resync to the next adts frame on invalid data instead of aborting

Should fix ticket #6634

Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 881e1f5a6227a6fbaf67083d4d4b6caf58ff9892)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb22b9ce211c934db628a4ab1669d436864753e3
---

 libavformat/aacdec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 4cd2f9077e..7008340a32 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -133,6 +133,7 @@ static int adts_aac_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, fsize;
 
+retry:
     ret = av_get_packet(s->pb, pkt, ADTS_HEADER_SIZE);
     if (ret < 0)
         return ret;
@@ -143,7 +144,10 @@ static int adts_aac_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if ((AV_RB16(pkt->data) >> 4) != 0xfff) {
         av_packet_unref(pkt);
-        return AVERROR_INVALIDDATA;
+        ret = adts_aac_resync(s);
+        if (ret < 0)
+            return ret;
+        goto retry;
     }
 
     fsize = (AV_RB32(pkt->data + 3) >> 13) & 0x1FFF;



More information about the ffmpeg-cvslog mailing list