mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 06:29:31 +00:00
pad-monitor: first buffer checks
Check that a newsegment is received before the first buffer and that the first buffer running time is 0
This commit is contained in:
parent
4e84ad6513
commit
6677b5a574
2 changed files with 30 additions and 0 deletions
|
@ -105,6 +105,7 @@ static void
|
||||||
gst_qa_pad_monitor_init (GstQaPadMonitor * pad_monitor)
|
gst_qa_pad_monitor_init (GstQaPadMonitor * pad_monitor)
|
||||||
{
|
{
|
||||||
gst_segment_init (&pad_monitor->segment, GST_FORMAT_BYTES);
|
gst_segment_init (&pad_monitor->segment, GST_FORMAT_BYTES);
|
||||||
|
pad_monitor->first_buffer = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,6 +127,28 @@ gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner,
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_qa_pad_monitor_check_first_buffer (GstQaPadMonitor * pad_monitor,
|
||||||
|
GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
if (G_UNLIKELY (pad_monitor->first_buffer)) {
|
||||||
|
pad_monitor->first_buffer = FALSE;
|
||||||
|
|
||||||
|
if (!pad_monitor->has_segment) {
|
||||||
|
GST_QA_MONITOR_REPORT_WARNING (pad_monitor, EVENT, EXPECTED,
|
||||||
|
"Received buffer before Segment event");
|
||||||
|
}
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer))) {
|
||||||
|
gint64 running_time = gst_segment_to_running_time (&pad_monitor->segment,
|
||||||
|
pad_monitor->segment.format, GST_BUFFER_TIMESTAMP (buffer));
|
||||||
|
if (running_time != 0) {
|
||||||
|
GST_QA_MONITOR_REPORT_WARNING (pad_monitor, BUFFER, TIMESTAMP,
|
||||||
|
"First buffer running time is not 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor,
|
gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor,
|
||||||
GstEvent * event, GstPadEventFunction handler)
|
GstEvent * event, GstPadEventFunction handler)
|
||||||
|
@ -348,6 +371,9 @@ gst_qa_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
|
||||||
GstQaPadMonitor *pad_monitor =
|
GstQaPadMonitor *pad_monitor =
|
||||||
g_object_get_data ((GObject *) pad, "qa-monitor");
|
g_object_get_data ((GObject *) pad, "qa-monitor");
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
gst_qa_pad_monitor_check_first_buffer (pad_monitor, buffer);
|
||||||
|
|
||||||
ret = pad_monitor->chain_func (pad, buffer);
|
ret = pad_monitor->chain_func (pad, buffer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -410,6 +436,8 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
|
||||||
{
|
{
|
||||||
GstQaPadMonitor *monitor = udata;
|
GstQaPadMonitor *monitor = udata;
|
||||||
|
|
||||||
|
gst_qa_pad_monitor_check_first_buffer (monitor, buffer);
|
||||||
|
|
||||||
/* TODO should we assume that a pad-monitor should always have an
|
/* TODO should we assume that a pad-monitor should always have an
|
||||||
* element-monitor as a parent? */
|
* element-monitor as a parent? */
|
||||||
if (G_LIKELY (GST_QA_MONITOR_GET_PARENT (monitor))) {
|
if (G_LIKELY (GST_QA_MONITOR_GET_PARENT (monitor))) {
|
||||||
|
|
|
@ -70,6 +70,8 @@ struct _GstQaPadMonitor {
|
||||||
gulong event_probe_id;
|
gulong event_probe_id;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
gboolean first_buffer;
|
||||||
|
|
||||||
gboolean has_segment;
|
gboolean has_segment;
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue