https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/860b8fc27ffbfd0a095e3fa4b0cd125d536283d3
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2915
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2891

From 860b8fc27ffbfd0a095e3fa4b0cd125d536283d3 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Thu, 29 Dec 2022 12:22:56 +0100
Subject: [PATCH] modules: fix rate update

Setting the rate with the PROP_rate would actually result in a rate
adjustment of 1.0f / rate, so do the same here.

See #2891
--- a/src/modules/module-pulse-tunnel.c
+++ b/src/modules/module-pulse-tunnel.c
@@ -270,7 +270,7 @@ static void update_rate(struct impl *impl, bool playback)
 			impl->current_latency, impl->target_latency);
 
 	SPA_FLAG_SET(impl->rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE);
-	impl->rate_match->rate = corr;
+	impl->rate_match->rate = 1.0f / corr;
 }
 
 static void playback_stream_process(void *d)
--- a/src/modules/module-rtp-source.c
+++ b/src/modules/module-rtp-source.c
@@ -272,7 +272,7 @@ static void stream_process(void *data)
 
 			if (sess->rate_match) {
 				SPA_FLAG_SET(sess->rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE);
-				sess->rate_match->rate = corr;
+				sess->rate_match->rate = 1.0f / corr;
 			}
 		}
 		spa_ringbuffer_read_data(&sess->ring,
-- 
GitLab


