From 3666c4810e441f51d59cdab644206aeb1ef335c4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 11 Jan 2022 17:52:41 +0100 Subject: [PATCH] audioconvert: ignore latency param on monitor ports Ignore latency params on the monitor ports of merger. They interfere with the latency reporting set by the adapter. The adapter will set the latency param from the follower on port 0 in the converter, so pass this on to the merger as the latency and ignore all other updates. Fixes a case where the latency of a sink would become 0 when a monitor port was recorded from. --- spa/plugins/audioconvert/audioconvert.c | 11 ++++++----- spa/plugins/audioconvert/merger.c | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index e4d352202..fcf2b1b64 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -1112,11 +1112,12 @@ impl_node_port_set_param(void *object, switch (id) { case SPA_PARAM_Latency: - target = this->fmt[SPA_DIRECTION_REVERSE(direction)]; - port_id = 0; - if ((res = spa_node_port_set_param(target, - direction, port_id, id, flags, param)) < 0) - return res; + if (port_id == 0) { + target = this->fmt[SPA_DIRECTION_REVERSE(direction)]; + if ((res = spa_node_port_set_param(target, + direction, port_id, id, flags, param)) < 0) + return res; + } break; } diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index aeb0ea558..bf67f0c9b 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -1031,7 +1031,11 @@ static int port_set_latency(void *object, enum spa_direction other = SPA_DIRECTION_REVERSE(direction); uint32_t i; - spa_log_debug(this->log, "%p: set latency direction:%d", this, direction); + spa_log_debug(this->log, "%p: set latency direction:%d id:%d", + this, direction, port_id); + + if (direction == SPA_DIRECTION_OUTPUT && port_id != 0) + return 0; if (latency == NULL) { this->latency[other] = SPA_LATENCY_INFO(other);