[pulseaudio-discuss] [PATCH 2/3] loopback: Cork source-output if sink is suspended

Frédéric Dalleau frederic.dalleau at linux.intel.com
Thu May 3 09:17:40 PDT 2012


---
 src/modules/module-loopback.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index ca3affd..9194f55 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -656,6 +656,17 @@ static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
     return dest != u->source_output->source->monitor_of;
 }
 
+/* Called from main thread */
+static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspended) {
+    struct userdata *u;
+
+    pa_sink_input_assert_ref(i);
+    pa_assert_ctl_context();
+    pa_assert_se(u = i->userdata);
+
+    pa_source_output_cork(u->source_output, suspended);
+}
+
 int pa__init(pa_module *m) {
     pa_modargs *ma = NULL;
     struct userdata *u;
@@ -789,6 +800,7 @@ int pa__init(pa_module *m) {
     u->sink_input->update_max_request = sink_input_update_max_request_cb;
     u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
+    u->sink_input->suspend = sink_input_suspend_cb;
     u->sink_input->userdata = u;
 
     pa_sink_input_set_requested_latency(u->sink_input, u->latency/3);
-- 
1.7.5.4



More information about the pulseaudio-discuss mailing list