From 428f766d11fe0736a69c81399bc544b36c6d00b2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Oct 2023 15:41:56 +0200 Subject: [PATCH] audioadapter: always pass Start when passthrough When we are operating in passthrough, let the Start command pass through to the follower in all cases. Only do the negotiate/buffers when not in passthrough. This fixes a case where the buffers are cleared on the alsa node and it Pauses but then never resumes in a Start because the node is already started. The real problem is probably somewhere else (in PipeWire) but for now this will improve things in passthrough. --- spa/plugins/audioconvert/audioadapter.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index caf3ed33d..2750838ca 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -373,9 +373,6 @@ static int negotiate_buffers(struct impl *this) struct spa_data *datas; uint64_t follower_flags, conv_flags; - if (this->target == this->follower) - return 0; - spa_log_debug(this->log, "%p: n_buffers:%d", this, this->n_buffers); if (this->n_buffers > 0) @@ -516,10 +513,9 @@ static int configure_format(struct impl *this, uint32_t flags, const struct spa_ this->have_format = format != NULL; if (format == NULL) { this->n_buffers = 0; - } else { + } else if (this->target != this->follower) { res = negotiate_buffers(this); } - return res; } @@ -846,9 +842,6 @@ static int negotiate_format(struct impl *this) struct spa_pod_builder b = { 0 }; int res; - if (this->target == this->follower) - return 0; - spa_log_debug(this->log, "%p: have_format:%d", this, this->have_format); if (this->have_format) @@ -920,12 +913,12 @@ static int impl_node_send_command(void *object, const struct spa_command *comman switch (SPA_NODE_COMMAND_ID(command)) { case SPA_NODE_COMMAND_Start: spa_log_debug(this->log, "%p: starting %d", this, this->started); - if (this->started) - return 0; - if ((res = negotiate_format(this)) < 0) - return res; - if ((res = negotiate_buffers(this)) < 0) - return res; + if (this->target != this->follower) { + if (this->started) + return 0; + if ((res = negotiate_format(this)) < 0) + return res; + } this->ready = true; this->warned = false; break;