movenc: fix assert failure caused by rounding.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 22 Nov 2012 19:38:51 +0000 (20:38 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 22 Nov 2012 19:58:06 +0000 (20:58 +0100)
Fixes Ticket1820

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/movenc.c

index f8ad73b..f08aa7e 100644 (file)
@@ -1721,8 +1721,8 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
         }
         avio_wb32(pb, 0x00010000);
     } else {
-        av_assert0(track->cluster[0].dts <= 0);
-        start_ct  = -track->cluster[0].dts;
+        av_assert0(av_rescale_rnd(track->cluster[0].dts, MOV_TIMESCALE, track->timescale, AV_ROUND_DOWN) <= 0);
+        start_ct  = -FFMIN(track->cluster[0].dts, 0); //FFMIN needed due to rounding
         duration += delay;
     }