From bc435dc6f31586fbb047006a80b7f28fbd344215 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 19 Feb 2024 15:10:32 +0100 Subject: [PATCH] audioadapter: recheck formats when EnumFormat changes When the follower has new EnumFormat, make sure we recheck the formats the next time the node is started. --- spa/plugins/audioconvert/audioadapter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 73bc8364d..c9c509367 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -88,6 +88,7 @@ struct impl { unsigned int add_listener:1; unsigned int have_format:1; + unsigned int recheck_format:1; unsigned int started:1; unsigned int ready:1; unsigned int async:1; @@ -853,11 +854,14 @@ static int negotiate_format(struct impl *this) struct spa_pod_builder b = { 0 }; int res; - spa_log_debug(this->log, "%p: have_format:%d", this, this->have_format); + spa_log_debug(this->log, "%p: have_format:%d recheck:%d", this, this->have_format, + this->recheck_format); - if (this->have_format) + if (this->have_format && !this->recheck_format) return 0; + this->recheck_format = false; + spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_node_send_command(this->follower, @@ -1292,6 +1296,7 @@ static void follower_port_info(void *data, if (idx == IDX_EnumFormat) { spa_log_debug(this->log, "new formats"); /* we will renegotiate when restarting */ + this->recheck_format = true; } this->params[idx].user++;