summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-21 02:30:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-21 04:41:21 +0100
commit1b872de8f49e9af41d4bc23e1ef783ae8094ffff (patch)
tree8c36d62028a597965e1de52643beb1786ab1bc83 /libavformat
parent76dd01ecd4ed51e0669773470ee0d8db2c2e4d3f (diff)
avformat/movenc: check that the input timestamps are within the range that can be stored in mov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b861cf877f..bb4d379c6c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3255,6 +3255,17 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
int size = pkt->size;
uint8_t *reformatted_data = NULL;
+ if (trk->entry) {
+ int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
+ if (duration < 0 || duration > INT_MAX) {
+ av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",
+ duration, pkt->dts
+ );
+
+ pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
+ pkt->pts = AV_NOPTS_VALUE;
+ }
+ }
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
int ret;
if (mov->fragments > 0) {