lavf/utils: correct the duration estimation method for nut demuxer
authorJun Zhao <barryjzhao@tencent.com>
Sat, 28 Sep 2019 02:45:31 +0000 (10:45 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Mon, 30 Sep 2019 02:08:16 +0000 (10:08 +0800)
in fact, nut demuxer use the PTS for duration estimation.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavformat/utils.c

index 07f02a7..9d69e3a 100644 (file)
@@ -2956,7 +2956,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
         /* at least one component has timings - we use them for all
          * the components */
         fill_all_stream_timings(ic);
-        ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
+        /* nut demuxer estimate the duration from PTS */
+        if(!strcmp(ic->iformat->name, "nut"))
+            ic->duration_estimation_method = AVFMT_DURATION_FROM_PTS;
+        else
+            ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
     } else {
         /* less precise: use bitrate info */
         estimate_timings_from_bit_rate(ic);