From 4f4f6432ccf99779a46be70bb3864ff0b673f7d2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sun, 4 Aug 2013 16:52:15 +0200 Subject: [PATCH] qtmux: Use buffer PTS if DTS is not set Avoids ending up with completely bogus scaled duration/pts when new buffers have invalid DTS. --- gst/isomp4/gstqtmux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index 7207a00b09..6a9de52352 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -2229,7 +2229,10 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf) if (pad->have_dts) { gint64 scaled_dts; if (pad->last_buf) { - pad->last_dts = GST_BUFFER_DTS (pad->last_buf); + if (GST_BUFFER_DTS_IS_VALID (pad->last_buf)) + pad->last_dts = GST_BUFFER_DTS (pad->last_buf); + else + pad->last_dts = GST_BUFFER_PTS (pad->last_buf); } else { pad->last_dts = GST_BUFFER_DTS (last_buf) + GST_BUFFER_DURATION (last_buf);