OSDN Git Service

lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing
authorAnton Khirnov <anton@khirnov.net>
Wed, 7 Oct 2015 09:48:28 +0000 (11:48 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 8 Nov 2015 10:48:47 +0000 (11:48 +0100)
The reasoning for setting it to zero only applies to demuxing.

libavformat/utils.c

index 42f60d5..1fe7c6f 100644 (file)
@@ -2549,16 +2549,18 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
 
         /* default pts setting is MPEG-like */
         avpriv_set_pts_info(st, 33, 1, 90000);
+        /* we set the current DTS to 0 so that formats without any timestamps
+         * but durations get some timestamps, formats with some unknown
+         * timestamps have their first few packets buffered and the
+         * timestamps corrected before they are returned to the user */
+        st->cur_dts = 0;
+    } else {
+        st->cur_dts = AV_NOPTS_VALUE;
     }
 
     st->index      = s->nb_streams;
     st->start_time = AV_NOPTS_VALUE;
     st->duration   = AV_NOPTS_VALUE;
-    /* we set the current DTS to 0 so that formats without any timestamps
-     * but durations get some timestamps, formats with some unknown
-     * timestamps have their first few packets buffered and the
-     * timestamps corrected before they are returned to the user */
-    st->cur_dts       = 0;
     st->first_dts     = AV_NOPTS_VALUE;
     st->probe_packets = MAX_PROBE_PACKETS;