summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/movenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6c95b4b3aa..4017a56158 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1628,6 +1628,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, -1);
}
avio_wb32(pb, 0x00010000);
+ } else {
+ /* Avoid accidentally ending up with start_ct = -1 which has got a
+ * special meaning. Normally start_ct should end up positive or zero
+ * here, but use FFMIN in case dts is a a small positive integer
+ * rounded to 0 when represented in MOV_TIMESCALE units. */
+ start_ct = -FFMIN(track->cluster[0].dts, 0);
+ duration += delay;
}
/* duration */