From e57a01594e2beb3294edebac13fcdce161e86592 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 20 Jan 2025 22:37:27 -0500 Subject: [PATCH] audioconvert: Only use rate_scale when working at DSP rate In convert mode, we will be resampling directly to the output rate, so don't try to scale to driver rate. --- spa/plugins/audioconvert/audioconvert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 99fa2a65d..b891d003d 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -2164,7 +2164,10 @@ static uint32_t resample_update_rate_match(struct impl *this, bool passthrough, delay_frac = 0; match_size = size; } else { - double rate = this->rate_scale / this->props.rate; + /* Only apply rate_scale if we're working in DSP mode (i.e. in driver rate) */ + double scale = this->dir[SPA_DIRECTION_OUTPUT].mode == SPA_PARAM_PORT_CONFIG_MODE_dsp ? + this->rate_scale : 1.0; + double rate = scale / this->props.rate; double fdelay; if (this->io_rate_match &&