--- src/modules/module-loopback.c | 5 +++++ src/pulse/sample.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index d22afb5..7474ef2 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -1039,6 +1039,11 @@ int pa__init(pa_module *m) { goto fail; } + if (ss.rate < 4000 || ss.rate > PA_RATE_MAX) { + pa_log("Invalid rate specification, valid range is 4000 Hz to %i Hz", PA_RATE_MAX); + goto fail; + } + if (pa_modargs_get_value(ma, "format", NULL)) format_set = true; 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.1.4