From 8f7acb717cda83f78fc128112e30d9b68337b2bd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 28 Apr 2023 10:47:30 +0200 Subject: [PATCH] audioconvert: clear format and buffers on start error. When we get an error, clear the ready state again and also clear the format a buffers that we might have negotiated before starting. --- spa/plugins/audioconvert/audioadapter.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 464e962f3..1bacdac57 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -867,21 +867,25 @@ static int impl_node_send_command(void *object, const struct spa_command *comman spa_log_error(this->log, "%p: can't send command %d: %s", this, SPA_NODE_COMMAND_ID(command), spa_strerror(res)); - return res; } - if (this->target != this->follower) { + if (res >= 0 && this->target != this->follower) { if ((res = spa_node_send_command(this->follower, command)) < 0) { spa_log_error(this->log, "%p: can't send command %d: %s", this, SPA_NODE_COMMAND_ID(command), spa_strerror(res)); - return res; } } switch (SPA_NODE_COMMAND_ID(command)) { case SPA_NODE_COMMAND_Start: - this->started = true; - spa_log_debug(this->log, "%p: started", this); + if (res < 0) { + spa_log_debug(this->log, "%p: start failed", this); + this->ready = false; + configure_format(this, 0, NULL); + } else { + this->started = true; + spa_log_debug(this->log, "%p: started", this); + } break; case SPA_NODE_COMMAND_Suspend: configure_format(this, 0, NULL);