From b0a0e83aee01bfecd8b789789d8522750f6ce9de Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 12 Mar 2012 20:36:51 +0100 Subject: [PATCH] Revert "flvenc: Remove apparently unneeded AAC check." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to video_file_format_spec_v10_1.pdf flv stores AAC RAW thanks to Baptiste Coudurier for pointing that out thanks to Aℓex Converse for explaining: This can't be at the start of a non-ADTS payload. 111 is the EndOfFrame syntax element. Together these proof that the check was correctly rejecting ADTS which is not supposed to be in flv. Many players are able to play such ADTS in flv though but its better if we conform to the spec as this should ensure that not many but all players can play files generated by ffmpeg. This reverts commit 3c9a86df0e20dd1c90a9b390a6555b22f87aa8cd. --- libavformat/flvenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index a6dab06875..d4820f4f58 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -445,6 +445,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0) return -1; } + } 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 (flv->delay == AV_NOPTS_VALUE) flv->delay = -pkt->dts;