From fbad7b593db76ad9d52511e8d6daa39d8509c94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Fri, 29 Nov 2024 20:19:53 +0100 Subject: [PATCH] validate-scenario: Fix busy waiting, missing lock execute_next_action_full() logs that it removes the source when an action returns ASYNC, but the code for that was incomplete, as it was setting source_id to zero but not actually removing the source. This lead to execute_next_action_full() being run continuously, only alliviated by the default 10ms interval in the GSource from `scenario->priv->action_execution_interval`. This patch fixes that. As a drive-by fix it also adds locking to one remaining unlocked usage of `priv->execute_actions_source_id`. Part-of: --- .../validate/gst/validate/gst-validate-scenario.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 372303fb99..5b0f7b4332 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-scenario.c @@ -3210,7 +3210,7 @@ execute_action: priv->execute_actions_source_id = 0; SCENARIO_UNLOCK (scenario); - return G_SOURCE_CONTINUE; + return G_SOURCE_REMOVE; case GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS: return G_SOURCE_CONTINUE; case GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING: @@ -3572,10 +3572,12 @@ _execute_wait_for_message (GstValidateScenario * scenario, gst_validate_printf (action, "Waiting for '%s' message\n", message_type); + SCENARIO_LOCK (scenario); if (priv->execute_actions_source_id) { g_source_remove (priv->execute_actions_source_id); priv->execute_actions_source_id = 0; } + SCENARIO_UNLOCK (scenario); g_assert (!priv->wait_message_action); priv->wait_message_action = gst_validate_action_ref (action);