[FFmpeg-cvslog] Only test the first frame for missing aac_adtstoasc bistream filter.

Carl Eugen Hoyos git at videolan.org
Wed Mar 27 01:20:38 CET 2013


ffmpeg | branch: release/0.10 | Carl Eugen Hoyos <cehoyos at ag.or.at> | Tue Mar 26 15:16:07 2013 +0100| [5dd5cfd0b8d3b658d3b517a617aeb57a233c68c4] | committer: Carl Eugen Hoyos

Only test the first frame for missing aac_adtstoasc bistream filter.

Many players ignore broken aac frames, so don't abort mov or flv
muxing when encountering one, just print a warning instead.

Fixes ticket #2380.
(cherry picked from commit 1741fece7073f51efdd837a4f307ea2cdf3d1cfb)

Conflicts:
	libavformat/flvenc.c

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

 libavformat/flvenc.c |    9 +++++++--
 libavformat/movenc.c |    3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 3f034bc..417a1c1 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -446,8 +446,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
     } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
                (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
-        av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
-        return -1;
+        if (!s->streams[pkt->stream_index]->nb_frames) {
+        av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
+               "use audio bitstream filter 'aac_adtstoasc' to fix it "
+               "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
+        return AVERROR_INVALIDDATA;
+        }
+        av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
     }
     if (flv->delay == AV_NOPTS_VALUE)
         flv->delay = -pkt->dts;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0d0d3e0..fdde517 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2595,8 +2595,11 @@ static int mov_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
         }
     } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
                (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
+        if (!s->streams[pkt->stream_index]->nb_frames) {
         av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
         return -1;
+        }
+        av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
     } else {
         avio_write(pb, pkt->data, size);
     }



More information about the ffmpeg-cvslog mailing list