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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8014>
This commit is contained in:
Alicia Boya García 2024-11-29 20:19:53 +01:00 committed by GStreamer Marge Bot
parent c683cdc914
commit fbad7b593d

View file

@ -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);