From 33a6cf5234b1748d3fe78fe8f235791dea49832e Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 19 Mar 2020 18:41:24 -0300 Subject: [PATCH] validate: Use pad.last_flowret instead of trying to compute it ourselves Which makes it more accurate Part-of: --- validate/gst/validate/gst-validate-pad-monitor.c | 16 +++--------- validate/gst/validate/gst-validate-pad-monitor.h | 2 -- validate/tests/check/validate/padmonitor.c | 33 ++++++++---------------- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/validate/gst/validate/gst-validate-pad-monitor.c b/validate/gst/validate/gst-validate-pad-monitor.c index fc2d66b..1c98f6e 100644 --- a/validate/gst/validate/gst-validate-pad-monitor.c +++ b/validate/gst/validate/gst-validate-pad-monitor.c @@ -985,8 +985,6 @@ gst_validate_pad_monitor_flush (GstValidatePadMonitor * pad_monitor) pad_monitor->current_timestamp = GST_CLOCK_TIME_NONE; pad_monitor->current_duration = GST_CLOCK_TIME_NONE; - pad_monitor->last_flow_return = GST_FLOW_OK; - pad_monitor->timestamp_range_start = GST_CLOCK_TIME_NONE; pad_monitor->timestamp_range_end = GST_CLOCK_TIME_NONE; } @@ -1387,7 +1385,6 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor * GstPad *otherpad; GstPad *peerpad; GstState state, pending; - GstValidatePadMonitor *othermonitor; GstFlowReturn aggregated = GST_FLOW_NOT_LINKED; gboolean found_a_pad = FALSE; GstPad *pad = @@ -1403,14 +1400,10 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor * otherpad = g_value_get_object (&value); peerpad = gst_pad_get_peer (otherpad); if (peerpad) { - othermonitor = _GET_PAD_MONITOR (peerpad); - if (othermonitor) { - found_a_pad = TRUE; - GST_VALIDATE_MONITOR_LOCK (othermonitor); - aggregated = - _combine_flows (aggregated, othermonitor->last_flow_return); - GST_VALIDATE_MONITOR_UNLOCK (othermonitor); - } + found_a_pad = TRUE; + aggregated = + _combine_flows (aggregated, + gst_pad_get_last_flow_return (peerpad)); gst_object_unref (peerpad); } @@ -2354,7 +2347,6 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstObject * parent, GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor); GST_VALIDATE_MONITOR_LOCK (pad_monitor); - pad_monitor->last_flow_return = ret; if (ret == GST_FLOW_EOS) { mark_pads_eos (pad_monitor); } diff --git a/validate/gst/validate/gst-validate-pad-monitor.h b/validate/gst/validate/gst-validate-pad-monitor.h index 1c753f3..22c3479 100644 --- a/validate/gst/validate/gst-validate-pad-monitor.h +++ b/validate/gst/validate/gst-validate-pad-monitor.h @@ -107,8 +107,6 @@ struct _GstValidatePadMonitor { GstClockTime current_timestamp; GstClockTime current_duration; - GstFlowReturn last_flow_return; - /* 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 diff --git a/validate/tests/check/validate/padmonitor.c b/validate/tests/check/validate/padmonitor.c index 83083dd..db20bd0 100644 --- a/validate/tests/check/validate/padmonitor.c +++ b/validate/tests/check/validate/padmonitor.c @@ -295,23 +295,13 @@ fake_demuxer_prepare_pads (GstBin * pipeline, GstElement * demux, TRUE)); } -static GstValidatePadMonitor * -_get_pad_monitor (GstPad * pad) -{ - GstValidatePadMonitor *m = get_pad_monitor (pad); - - gst_object_unref (pad); - - return m; -} - static void _test_flow_aggregation (GstFlowReturn flow, GstFlowReturn flow1, GstFlowReturn flow2, GstFlowReturn demux_flow, gboolean should_fail) { GstPad *srcpad; GstValidateReport *report; - GstValidatePadMonitor *pmonitor, *pmonitor1, *pmonitor2; + GstPad *p, *p1, *p2; GstElement *demuxer = fake_demuxer_new (); GstBin *pipeline = GST_BIN (gst_pipeline_new ("validate-pipeline")); GList *reports; @@ -329,17 +319,19 @@ _test_flow_aggregation (GstFlowReturn flow, GstFlowReturn flow1, gst_check_setup_events_with_stream_id (srcpad, demuxer, NULL, GST_FORMAT_TIME, "the-stream"); - pmonitor = _get_pad_monitor (gst_pad_get_peer (demuxer->srcpads->data)); - pmonitor1 = - _get_pad_monitor (gst_pad_get_peer (demuxer->srcpads->next->data)); - pmonitor2 = - _get_pad_monitor (gst_pad_get_peer (demuxer->srcpads->next->next->data)); + p = gst_pad_get_peer (demuxer->srcpads->data); + p1 = gst_pad_get_peer (demuxer->srcpads->next->data); + p2 = gst_pad_get_peer (demuxer->srcpads->next->next->data); - pmonitor->last_flow_return = flow; - pmonitor1->last_flow_return = flow1; - pmonitor2->last_flow_return = flow2; + p->ABI.abi.last_flowret = flow; + p1->ABI.abi.last_flowret = flow1; + p2->ABI.abi.last_flowret = flow2; FAKE_DEMUXER (demuxer)->return_value = demux_flow; + gst_object_unref (p); + gst_object_unref (p1); + gst_object_unref (p2); + fail_unless_equals_int (gst_pad_push (srcpad, gst_discont_buffer_new ()), demux_flow); @@ -360,13 +352,10 @@ _test_flow_aggregation (GstFlowReturn flow, GstFlowReturn flow1, gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); ASSERT_OBJECT_REFCOUNT (pipeline, "ours", 1); gst_object_ref (demuxer); - gst_object_ref (pmonitor); _stop_monitoring_bin (pipeline, runner); ASSERT_OBJECT_REFCOUNT (demuxer, "plop", 1); gst_object_unref (demuxer); - ASSERT_OBJECT_REFCOUNT (pmonitor, "plop", 1); - gst_object_unref (pmonitor); gst_object_unref (srcpad); } -- 2.7.4