[pulseaudio-discuss] [PATCH 2/2] remap-source, virtual-source: fix max_rewind handling

Tanu Kaskinen tanuk at iki.fi
Tue Oct 31 13:29:26 UTC 2017


The filter sources should have the same max_rewind as the master source,
but these modules didn't update max_rewind when the master max_rewind
changed.
---
 src/modules/module-remap-source.c   | 12 ++++++++++++
 src/modules/module-virtual-source.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/src/modules/module-remap-source.c b/src/modules/module-remap-source.c
index 281d651f4..980f2554a 100644
--- a/src/modules/module-remap-source.c
+++ b/src/modules/module-remap-source.c
@@ -175,6 +175,17 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes)
         pa_source_process_rewind(u->source, nbytes);
 }
 
+/* Called from output thread context */
+static void source_output_update_max_rewind_cb(pa_source_output *o, size_t nbytes) {
+    struct userdata *u;
+
+    pa_source_output_assert_ref(o);
+    pa_source_output_assert_io_context(o);
+    pa_assert_se(u = o->userdata);
+
+    pa_source_set_max_rewind_within_thread(u->source, nbytes);
+}
+
 /* Called from output thread context */
 static void source_output_detach_cb(pa_source_output *o) {
     struct userdata *u;
@@ -387,6 +398,7 @@ int pa__init(pa_module*m) {
 
     u->source_output->push = source_output_push_cb;
     u->source_output->process_rewind = source_output_process_rewind_cb;
+    u->source_output->update_max_rewind = source_output_update_max_rewind_cb;
     u->source_output->kill = source_output_kill_cb;
     u->source_output->attach = source_output_attach_cb;
     u->source_output->detach = source_output_detach_cb;
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index 94907dfa9..8ec4525a7 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -370,6 +370,17 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes)
 #endif
 }
 
+/* Called from output thread context */
+static void source_output_update_max_rewind_cb(pa_source_output *o, size_t nbytes) {
+    struct userdata *u;
+
+    pa_source_output_assert_ref(o);
+    pa_source_output_assert_io_context(o);
+    pa_assert_se(u = o->userdata);
+
+    pa_source_set_max_rewind_within_thread(u->source, nbytes);
+}
+
 /* Called from output thread context */
 static void source_output_attach_cb(pa_source_output *o) {
     struct userdata *u;
@@ -605,6 +616,7 @@ int pa__init(pa_module*m) {
 
     u->source_output->push = source_output_push_cb;
     u->source_output->process_rewind = source_output_process_rewind_cb;
+    u->source_output->update_max_rewind = source_output_update_max_rewind_cb;
     u->source_output->kill = source_output_kill_cb;
     u->source_output->attach = source_output_attach_cb;
     u->source_output->detach = source_output_detach_cb;
-- 
2.14.2



More information about the pulseaudio-discuss mailing list