aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2013-03-30 08:41:46 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-04-02 12:50:25 +0200
commitbd6e58d5cadd5e5871d930f21f51224b3120cf8f (patch)
treefcadd004fa0880bad0068422385275fafedb1544
parentfe995dcd84c6e2aca3216a10a996ecfbba964b6c (diff)
downloadffmpeg-bd6e58d5cadd5e5871d930f21f51224b3120cf8f.tar.gz
Write broken aac frames to mov files instead of skipping them.
Fixes decoding with picky media players. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit b448c0a68d0cc7dfef736267dfdaed0e213c020b)
-rw-r--r--libavformat/movenc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 18dbffa8cc..af0a27e379 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3085,6 +3085,14 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
memcpy(trk->vos_data, enc->extradata, trk->vos_len);
}
+ if (enc->codec_id == AV_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");
+ }
if (enc->codec_id == AV_CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1) {
/* from x264 or from bytestream h264 */
/* nal reformating needed */
@@ -3095,13 +3103,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
} else {
size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
}
- } else if (enc->codec_id == AV_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);
}