matroskamux: don't drop JPEG frames that only have PTS but no DTS set
authorNicola Murino <nicola.murino@gmail.com>
Tue, 27 Oct 2015 09:48:00 +0000 (10:48 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 28 Oct 2015 19:17:54 +0000 (19:17 +0000)
For the MS/VfW codec ids, we want to write DTS timestamps instead
of PTS because that's what everyone else seems to do (and it's also
how it is in AVI). So for those input formats we use the buffer DTS
instead of the PTS. However, if there's no DTS set but only the PTS
then just take the PTS instead of dropping the input buffer. This
is useful especially for I-frame only codecs like JPEG and huffyuv,
but should also be fine as fallback in general.

Fixes regression with input JPEG frames that only have PTS set on them.

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

gst/matroska/matroska-ids.c

index 52e5dc30d1778f1eaff33a22d50b49d2ac536ebd..273d4e1e2ffb469bda8f02437311628067b0b9e9 100644 (file)
@@ -305,7 +305,10 @@ gst_matroska_track_get_buffer_timestamp (GstMatroskaTrackContext * track,
     GstBuffer * buf)
 {
   if (track->dts_only) {
-    return GST_BUFFER_DTS (buf);
+    if (GST_BUFFER_DTS_IS_VALID (buf))
+      return GST_BUFFER_DTS (buf);
+    else
+      return GST_BUFFER_PTS (buf);
   } else {
     return GST_BUFFER_PTS (buf);
   }