[pulseaudio-discuss] [PATCH] loopback: Always use the trivial resampler.

Tanu Kaskinen tanu.kaskinen at digia.com
Thu Mar 24 06:16:30 PDT 2011


Adjusting the sample rate is done in the IO thread, which can cause
interruptions in the audio if the adjustment requires heavy computation. The
trivial resampler is guaranteed to be light on the cpu.

It would be better to adjust the sample rate in some other thread (FWIW,
module-combine uses the main thread), but this quick hack fixes the immediate
problem of spending too much time in the IO thread.
---
 src/modules/module-loopback.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 9a8640b..3ade248 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -714,6 +714,7 @@ int pa__init(pa_module *m) {
     pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
     pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
     sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE;
+    sink_input_data.resample_method = PA_RESAMPLER_TRIVIAL;
 
     sink_dont_move = FALSE;
     if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) {
-- 
1.7.4.1




More information about the pulseaudio-discuss mailing list