From 506af5b8e4cb9f623c683692fde4d2f95a8d4847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Wed, 19 Jun 2024 15:31:11 +0200 Subject: [PATCH] gst-validate: Don't treat FALSE when sending flushes as an error gst_element_send_event(FLUSH_START / FLUSH_STOP) returns FALSE in cases where any of the most downstream elements have unlinked pads, even if the pipeline is successfully flushed. Currently this is considered expected behavior in GStreamer. This patch updates gst-validate to treat it as such and therefore not fail the test for a "failing" flush. Part-of: --- .../gst/validate/gst-validate-scenario.c | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c index 74ffc2aef6..4972f93119 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c @@ -4432,6 +4432,7 @@ _execute_flush (GstValidateScenario * scenario, GstValidateAction * action) { GstElement *target; GstEvent *event; + gboolean ret; gboolean reset_time = TRUE; target = _get_target_element (scenario, action); @@ -4446,19 +4447,28 @@ _execute_flush (GstValidateScenario * scenario, GstValidateAction * action) gst_structure_get_boolean (action->structure, "reset-time", &reset_time); + // FLUSH_START and FLUSH_STOP are "fire-and-forget" events. + // + // In the case of a pipeline where the most downstream element has unlinked srcpads + // (as is the case for many autoplugging elements before preroll), the event will + // "fail" due to "not-linked" but will have still correctly flushed all the existing + // elements and pads. + // + // For this reason, we cannot consider a test failed if a FLUSH_START or FLUSH_STOP + // "fails". However, since those "failures" reflect edge cases, we still want to log + // them as they can become useful during debugging. + // + // Source: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7064#note_2460206 + event = gst_event_new_flush_start (); - if (!gst_element_send_event (target, event)) { - GST_VALIDATE_REPORT_ACTION (scenario, action, - SCENARIO_ACTION_EXECUTION_ERROR, "FLUSH_START event was not handled"); - return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; - } + ret = gst_element_send_event (target, event); + GST_DEBUG_OBJECT (scenario, "Sending FLUSH_START event returned %s.", + ret ? "TRUE" : "FALSE"); event = gst_event_new_flush_stop (reset_time); - if (!gst_element_send_event (target, event)) { - GST_VALIDATE_REPORT_ACTION (scenario, action, - SCENARIO_ACTION_EXECUTION_ERROR, "FLUSH_STOP event was not handled"); - return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; - } + ret = gst_element_send_event (target, event); + GST_DEBUG_OBJECT (scenario, "Sending FLUSH_STOP event returned %s.", + ret ? "TRUE" : "FALSE"); return GST_VALIDATE_EXECUTE_ACTION_OK; }