typefindelement: Propagate input buffer PTS and DTS
authorEdward Hervey <edward@collabora.com>
Thu, 17 Jul 2014 05:07:36 +0000 (07:07 +0200)
committerEdward Hervey <edward@collabora.com>
Thu, 17 Jul 2014 07:45:54 +0000 (09:45 +0200)
The initial buffers (that were used for timestamping) might have PTS
and DTS set. In order to forward those properly, get the initial
PTS/DTS from the adapter and set them on the reconstructed output
buffer.

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

plugins/elements/gsttypefindelement.c

index 400c370..02ce2be 100644 (file)
@@ -540,6 +540,7 @@ stop_typefinding (GstTypeFindElement * typefind)
   gboolean push_cached_buffers;
   gsize avail;
   GstBuffer *buffer;
+  GstClockTime pts, dts;
 
   gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, 0);
 
@@ -557,7 +558,11 @@ stop_typefinding (GstTypeFindElement * typefind)
   if (avail == 0)
     goto no_data;
 
+  pts = gst_adapter_prev_pts (typefind->adapter, NULL);
+  dts = gst_adapter_prev_dts (typefind->adapter, NULL);
   buffer = gst_adapter_take_buffer (typefind->adapter, avail);
+  GST_BUFFER_PTS (buffer) = pts;
+  GST_BUFFER_DTS (buffer) = dts;
   GST_OBJECT_UNLOCK (typefind);
 
   if (!push_cached_buffers) {