diff --git a/validate/gst/qa/gst-qa-pad-monitor.c b/validate/gst/qa/gst-qa-pad-monitor.c index b597144f57..9447b951b3 100644 --- a/validate/gst/qa/gst-qa-pad-monitor.c +++ b/validate/gst/qa/gst-qa-pad-monitor.c @@ -237,6 +237,12 @@ static gboolean gst_qa_pad_monitor_timestamp_is_in_received_range (GstQaPadMonitor * monitor, GstClockTime ts) { + GST_DEBUG_OBJECT (monitor, "Checking if timestamp %" GST_TIME_FORMAT + " is in range: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT " for pad " + "%s:%s", GST_TIME_ARGS (ts), + GST_TIME_ARGS (monitor->timestamp_range_start), + GST_TIME_ARGS (monitor->timestamp_range_end), + GST_DEBUG_PAD_NAME (GST_QA_PAD_MONITOR_GET_PAD (monitor))); return !GST_CLOCK_TIME_IS_VALID (monitor->timestamp_range_start) || !GST_CLOCK_TIME_IS_VALID (monitor->timestamp_range_end) || (monitor->timestamp_range_start <= ts @@ -311,38 +317,6 @@ gst_qa_pad_monitor_check_buffer_timestamp_in_received_range (GstQaPadMonitor * } } -static void -gst_qa_pad_monitor_notify_buffer_pushed (GstQaPadMonitor * monitor) -{ - GstIterator *iter; - gboolean done; - GstPad *otherpad; - GstQaPadMonitor *othermonitor; - - iter = gst_pad_iterate_internal_links (GST_QA_PAD_MONITOR_GET_PAD (monitor)); - done = FALSE; - while (!done) { - switch (gst_iterator_next (iter, (gpointer *) & otherpad)) { - case GST_ITERATOR_OK: - othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor"); - othermonitor->buffer_pushed = TRUE; - gst_object_unref (otherpad); - break; - case GST_ITERATOR_RESYNC: - gst_iterator_resync (iter); - break; - case GST_ITERATOR_ERROR: - GST_WARNING_OBJECT (monitor, "Internal links pad iteration error"); - done = TRUE; - break; - case GST_ITERATOR_DONE: - done = TRUE; - break; - } - } - gst_iterator_free (iter); -} - static void gst_qa_pad_monitor_check_first_buffer (GstQaPadMonitor * pad_monitor, GstBuffer * buffer) @@ -370,20 +344,33 @@ static void gst_qa_pad_monitor_update_buffer_data (GstQaPadMonitor * pad_monitor, GstBuffer * buffer) { + /* TODO handle reverse playback too */ pad_monitor->current_timestamp = GST_BUFFER_TIMESTAMP (buffer); pad_monitor->current_duration = GST_BUFFER_DURATION (buffer); - if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)) && - GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer))) { - if (pad_monitor->buffer_pushed) { + if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer))) { + if (GST_CLOCK_TIME_IS_VALID (pad_monitor->timestamp_range_start)) { + pad_monitor->timestamp_range_start = + MIN (pad_monitor->timestamp_range_start, + GST_BUFFER_TIMESTAMP (buffer)); + } else { pad_monitor->timestamp_range_start = GST_BUFFER_TIMESTAMP (buffer); } - pad_monitor->timestamp_range_end = GST_BUFFER_TIMESTAMP (buffer) + - GST_BUFFER_DURATION (buffer); - } else { - pad_monitor->timestamp_range_start = GST_CLOCK_TIME_NONE; - pad_monitor->timestamp_range_end = GST_CLOCK_TIME_NONE; + + if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer))) { + GstClockTime endts = + GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer); + if (GST_CLOCK_TIME_IS_VALID (pad_monitor->timestamp_range_end)) { + pad_monitor->timestamp_range_end = + MAX (pad_monitor->timestamp_range_end, endts); + } else { + pad_monitor->timestamp_range_end = endts; + } + } } - pad_monitor->buffer_pushed = FALSE; + GST_DEBUG_OBJECT (pad_monitor, "Current stored range: %" GST_TIME_FORMAT + " - %" GST_TIME_FORMAT, + GST_TIME_ARGS (pad_monitor->timestamp_range_start), + GST_TIME_ARGS (pad_monitor->timestamp_range_end)); } static GstFlowReturn @@ -827,7 +814,6 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer, gst_qa_pad_monitor_update_buffer_data (monitor, buffer); gst_qa_pad_monitor_check_buffer_timestamp_in_received_range (monitor, buffer); - gst_qa_pad_monitor_notify_buffer_pushed (monitor); /* TODO should we assume that a pad-monitor should always have an * element-monitor as a parent? */ diff --git a/validate/gst/qa/gst-qa-pad-monitor.h b/validate/gst/qa/gst-qa-pad-monitor.h index 4bbb567c4e..3464fcbe43 100644 --- a/validate/gst/qa/gst-qa-pad-monitor.h +++ b/validate/gst/qa/gst-qa-pad-monitor.h @@ -88,17 +88,16 @@ struct _GstQaPadMonitor { GstFlowReturn last_flow_return; - /* Stores the current timestamp range of data - * in this pad by using TIMESTAMP and TIMESTAMP+DURATION from - * incomming buffers. + /* Stores the timestamp range of data that has flown through + * this pad by using TIMESTAMP and TIMESTAMP+DURATION from + * incomming buffers. Every time a buffer is pushed, this range + * is extended. * - * If the internally linked pads haven't pushed a buffer, it will - * update the end to the new TIMESTAMP+DURATION, in case a buffer - * was pushed, the start is also updated to be TIMESTMAP. + * When a buffer is pushed, the timestamp range is checked against + * the outgoing timestamp to check it is in the received boundaries. */ GstClockTime timestamp_range_start; GstClockTime timestamp_range_end; - gboolean buffer_pushed; }; /**