Fix rounding direction for calculation of AVPacket.duration.
[libav.git] / libavformat / utils.c
index 0cb5e47..5f9feec 100644 (file)
@@ -886,7 +886,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     if (pkt->duration == 0) {
         compute_frame_duration(&num, &den, st, pc, pkt);
         if (den && num) {
-            pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num);
+            pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
 
             if(pkt->duration != 0 && s->packet_buffer)
                 update_initial_durations(s, st, pkt);