avformat/mxfdec: use int math for sample count calculation
authorMarton Balint <cus@passwd.hu>
Sat, 26 May 2018 08:51:16 +0000 (10:51 +0200)
committerMarton Balint <cus@passwd.hu>
Wed, 30 May 2018 21:02:59 +0000 (23:02 +0200)
This also changes the rounding to nearest.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mxfdec.c

index 40c9e0c..78a2aa7 100644 (file)
@@ -3167,8 +3167,7 @@ static int mxf_compute_sample_count(MXFContext *mxf, int stream_index,
     if (!spf) {
         int remainder = (sample_rate.num * time_base.num) %
                         (time_base.den * sample_rate.den);
-        *sample_count = av_q2d(av_mul_q((AVRational){mxf->current_edit_unit, 1},
-                                        av_mul_q(sample_rate, time_base)));
+        *sample_count = av_rescale_q(mxf->current_edit_unit, sample_rate, track->edit_rate);
         if (remainder)
             av_log(mxf->fc, AV_LOG_WARNING,
                    "seeking detected on stream #%d with time base (%d/%d) and "