aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2011-01-28 21:32:09 -0800
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2011-04-18 14:30:14 -0700
commitc22f2527ed33c429022dee6ee9e70c349145343e (patch)
treed8ae45e00debff5a3f81017ce37552d288a61d90
parent77f6b4d58eb76f4dbf208a8bfbd3dbf6e06da8f4 (diff)
downloadffmpeg-c22f2527ed33c429022dee6ee9e70c349145343e.tar.gz
In mov and flv muxer, check aac bitstream validity.
-rw-r--r--libavformat/flvenc.c6
-rw-r--r--libavformat/movenc.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index b1e048551f..3e933ce922 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -18,6 +18,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "flv.h"
#include "internal.h"
@@ -402,6 +404,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (!flv->delay && pkt->dts < 0)
flv->delay = -pkt->dts;
+ } 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;
}
ts = pkt->dts + flv->delay; // add delay to force positive dts
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5bc356279a..eec61fed66 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1993,6 +1993,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
/* from x264 or from bytestream h264 */
/* nal reformating needed */
size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
+ } 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;
} else {
avio_write(pb, pkt->data, size);
}