From e1b6a4237f4d5ee46f0260b4084b9578e77334fc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Oct 2023 10:56:06 +0200 Subject: [PATCH] context: use smallest fraction for largest rate To find the largest rate, we need to select the smallest fraction. This fixes the case where 44100Hz was selected when there are 2 nodes, one suggesting 44.1Khz and another 48Khz. After this, 48KHz is selected. --- src/pipewire/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 8d3d64756..f5dc4f950 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1365,10 +1365,10 @@ again: fraction_compare(&s->max_latency, &max_latency) < 0)) max_latency = s->max_latency; - /* largest rate */ + /* largest rate, which is in fact the smallest fraction */ if (rate.denom == 0 || (s->rate.denom > 0 && - fraction_compare(&s->rate, &rate) > 0)) + fraction_compare(&s->rate, &rate) < 0)) rate = s->rate; if (s->active)