[pulseaudio-discuss] [PATCH v6 13/25] sample.c: Allow module-loopback to exceed PA_RATE_MAX

Georg Chini georg at chini.tk
Sun Jun 5 19:05:16 UTC 2016


The rate set by module loopback may exceed PA_RATE_MAX by 1%, therefore
allow rates higher than PA_RATE_MAX in pa_sample_rate_valid()

---
 src/pulse/sample.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 1331c72..69ac83f 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -106,7 +106,10 @@ int pa_sample_format_valid(unsigned format) {
 }
 
 int pa_sample_rate_valid(uint32_t rate) {
-    return rate > 0 && rate <= PA_RATE_MAX;
+    /* The extra 1% is due to module-loopback: it temporarily sets
+     * a higher-than-nominal rate to get rid of excessive buffer
+     * latency */
+    return rate > 0 && rate <= PA_RATE_MAX * 101 / 100;
 }
 
 int pa_channels_valid(uint8_t channels) {
-- 
2.8.1



More information about the pulseaudio-discuss mailing list