ffmpeg.c: Fallback to duration_dts, when duration_pts can't be determined.
authorSasi Inguva <isasi-at-google.com@ffmpeg.org>
Tue, 10 Oct 2017 17:36:58 +0000 (10:36 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 11 Oct 2017 23:27:52 +0000 (01:27 +0200)
This is required for FLV files, for which duration_pts comes out to be zero.

Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
fftools/ffmpeg.c

index 6d64bc1..3ee3147 100644 (file)
@@ -2665,8 +2665,13 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
                     ist->next_dts = AV_NOPTS_VALUE;
             }
 
                     ist->next_dts = AV_NOPTS_VALUE;
             }
 
-            if (got_output)
-                ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
+            if (got_output) {
+                if (duration_pts > 0) {
+                    ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
+                } else {
+                    ist->next_pts += duration_dts;
+                }
+            }
             break;
         case AVMEDIA_TYPE_SUBTITLE:
             if (repeating)
             break;
         case AVMEDIA_TYPE_SUBTITLE:
             if (repeating)