From cf3d4c3b5d5b03eace222db6372a56120fa62c63 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 Dec 2022 13:12:18 +0100 Subject: [PATCH] audioadapter: clear started flag earlier First clear the started flag so that we ignore scheduling from the follower. Then stop the follower and the converter. This is the sequence we follow when deactivating a node, so do the same here. it is important that the node is not scheduled anymore when we clear the format in suspend or else we might crash. See #2877 --- spa/plugins/audioconvert/audioadapter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index a88e9524b..a30aabea9 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -852,9 +852,11 @@ static int impl_node_send_command(void *object, const struct spa_command *comman this->started = true; break; case SPA_NODE_COMMAND_Suspend: + this->started = false; spa_log_debug(this->log, "%p: suspending", this); break; case SPA_NODE_COMMAND_Pause: + this->started = false; spa_log_debug(this->log, "%p: pausing", this); break; case SPA_NODE_COMMAND_Flush: @@ -886,10 +888,10 @@ static int impl_node_send_command(void *object, const struct spa_command *comman break; case SPA_NODE_COMMAND_Suspend: configure_format(this, 0, NULL); - SPA_FALLTHROUGH + spa_log_debug(this->log, "%p: suspended", this); + break; case SPA_NODE_COMMAND_Pause: - this->started = false; - spa_log_debug(this->log, "%p: stopped", this); + spa_log_debug(this->log, "%p: paused", this); break; case SPA_NODE_COMMAND_Flush: spa_log_debug(this->log, "%p: flushed", this);