pad-monitor: track current buffer timestamp and duration
authorThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 17 Jul 2013 03:30:21 +0000 (00:30 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 17 Jul 2013 03:30:21 +0000 (00:30 -0300)
This can be used to make sure outgoing buffers match the input
timestamps

validate/gst/qa/gst-qa-pad-monitor.c
validate/gst/qa/gst-qa-pad-monitor.h

index ccf134c..55cb0d9 100644 (file)
@@ -233,6 +233,15 @@ gst_qa_pad_monitor_check_first_buffer (GstQaPadMonitor * pad_monitor,
   }
 }
 
+static void
+gst_qa_pad_monitor_update_buffer_data (GstQaPadMonitor * pad_monitor,
+    GstBuffer * buffer)
+{
+  pad_monitor->current_timestamp = GST_BUFFER_TIMESTAMP (buffer);
+  pad_monitor->current_duration = GST_BUFFER_DURATION (buffer);
+}
+
+
 static gboolean
 gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor,
     GstEvent * event, GstPadEventFunction handler)
@@ -461,7 +470,10 @@ gst_qa_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
 
   gst_qa_pad_monitor_check_first_buffer (pad_monitor, buffer);
 
+  gst_qa_pad_monitor_update_buffer_data (pad_monitor, buffer);
+
   ret = pad_monitor->chain_func (pad, buffer);
+
   return ret;
 }
 
@@ -524,6 +536,7 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
   GstQaPadMonitor *monitor = udata;
 
   gst_qa_pad_monitor_check_first_buffer (monitor, buffer);
+  gst_qa_pad_monitor_update_buffer_data (monitor, buffer);
 
   /* TODO should we assume that a pad-monitor should always have an
    * element-monitor as a parent? */
index 114c9a4..e64ce58 100644 (file)
@@ -73,12 +73,16 @@ struct _GstQaPadMonitor {
   gboolean first_buffer;
 
   gboolean has_segment;
-  GstSegment segment;
 
   gboolean pending_flush_stop;
   guint32 pending_flush_stop_seqnum;
   guint32 pending_flush_start_seqnum;
   guint32 pending_newsegment_seqnum;
+
+  /* tracked data */
+  GstSegment segment;
+  GstClockTime current_timestamp;
+  GstClockTime current_duration;
 };
 
 /**