[pulseaudio-discuss] [PATCH 1/4] loopback: Use the real sample spec once it's known.

Tanu Kaskinen tanu.kaskinen at digia.com
Tue Aug 14 07:08:34 PDT 2012


When module-loopback is loaded without arguments, the ss and
map variables are initialized with dummy values. This caused
a problem, because also pa_memblockq_new() was called with
the dummy values, making it work incorrectly. The base was
set to 1 instead of the real frame size, which in turn
caused alignment related crashes.
---
 src/modules/module-loopback.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 9054700..f71cd81 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -796,6 +796,11 @@ int pa__init(pa_module *m) {
     if (!u->sink_input)
         goto fail;
 
+    /* If format, rate or channels were originally unset, they are set now
+     * after the pa_sink_input_new() call. */
+    ss = u->sink_input->sample_spec;
+    map = u->sink_input->channel_map;
+
     u->sink_input->parent.process_msg = sink_input_process_msg_cb;
     u->sink_input->pop = sink_input_pop_cb;
     u->sink_input->process_rewind = sink_input_process_rewind_cb;
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list