qtmux: store last_dts of the first buffer
authorThiago Santos <thiagoss@osg.samsung.com>
Tue, 23 Jun 2015 01:22:09 +0000 (22:22 -0300)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Wed, 24 Jun 2015 02:34:35 +0000 (22:34 -0400)
Buffers need not to start at running-time 0 so the last_dts needs
to be the value of the first buffer's dts as it is used to compute
the duration of the buffers. If it was left at 0 the first buffer
would have a larger duration when it shouldn't

https://bugzilla.gnome.org/show_bug.cgi?id=751361

gst/isomp4/gstqtmux.c

index 5548a0c..2ee662f 100644 (file)
@@ -3045,6 +3045,12 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
       pad->first_ts = GST_BUFFER_DTS (last_buf);
     }
 
+    if (GST_BUFFER_DTS_IS_VALID (last_buf)) {
+      pad->last_dts = GST_BUFFER_DTS (last_buf);
+    } else if (GST_BUFFER_PTS_IS_VALID (last_buf)) {
+      pad->last_dts = GST_BUFFER_PTS (last_buf);
+    }
+
     if (GST_CLOCK_TIME_IS_VALID (pad->first_ts)) {
       GST_DEBUG ("setting first_ts to %" G_GUINT64_FORMAT, pad->first_ts);
     } else {