From ad784ca5e6a96d549c6f0ccdae04ecd0cdf65640 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 13 Dec 2023 12:26:26 +0100 Subject: [PATCH] audioadapter: improve state check Update the started and ready state after we suspend/pause the node so that we don't complain if scheduling happens between setting the fields and actually stopping the follower. Also only complain when the scheduling happens when the node is not ready. It is possible that the node is scheduled before we manage to set the started field. --- spa/plugins/audioconvert/audioadapter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 4b04f08f8..3d31e9ac7 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -927,15 +927,9 @@ static int impl_node_send_command(void *object, const struct spa_command *comman this->warned = false; break; case SPA_NODE_COMMAND_Suspend: - this->started = false; - this->ready = false; - this->warned = false; spa_log_debug(this->log, "%p: suspending", this); break; case SPA_NODE_COMMAND_Pause: - this->started = false; - this->ready = false; - this->warned = false; spa_log_debug(this->log, "%p: pausing", this); break; case SPA_NODE_COMMAND_Flush: @@ -972,9 +966,15 @@ static int impl_node_send_command(void *object, const struct spa_command *comman break; case SPA_NODE_COMMAND_Suspend: configure_format(this, 0, NULL); + this->started = false; + this->warned = false; + this->ready = false; spa_log_debug(this->log, "%p: suspended", this); break; case SPA_NODE_COMMAND_Pause: + this->started = false; + this->warned = false; + this->ready = false; spa_log_debug(this->log, "%p: paused", this); break; case SPA_NODE_COMMAND_Flush: @@ -1572,7 +1572,7 @@ static int impl_node_process(void *object) struct impl *this = object; int status = 0, fstatus, retry = 8; - if (!this->started) { + if (!this->ready) { if (!this->warned) spa_log_warn(this->log, "%p: scheduling stopped node", this); this->warned = true;