From a0518e28bb5b69758b707c42fe4efad37a714a4b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 22 Apr 2026 18:00:59 +0200 Subject: [PATCH] audioconvert: avoid some float/double/int conversions --- spa/plugins/audioconvert/audioconvert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 9df4537d6..17e0f7ff3 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -1687,7 +1688,7 @@ static struct spa_pod *generate_ramp_seq(struct impl *this, struct volume_ramp_p while (1) { float pos = (samples == 0) ? end : - SPA_CLAMP(start + (end - start) * offs / samples, + SPA_CLAMPF(start + (end - start) * offs / samples, SPA_MIN(start, end), SPA_MAX(start, end)); float vas = get_volume_at_scale(vrp, pos); @@ -2496,7 +2497,7 @@ static uint32_t resample_update_rate_match(struct impl *this, bool passthrough, match_size = resample_out_len(&this->resample, size); } - delay = (uint32_t)round(fdelay); + delay = lround(fdelay); delay_frac = (int32_t)((fdelay - delay) * 1e9); } match_size -= SPA_MIN(match_size, queued);