[pulseaudio-discuss] [PATCH] source-output: Get the correct source for "direct_on_input" streams

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Aug 14 06:58:24 PDT 2013


If a capture stream captures from a single sink input (so the capture
stream is a so called "direct on input" stream), then it needs to
connect to the monitor source of the sink to which the sink input is
connected. Previously the correct source was not figured out
automatically, causing the capture stream creation to fail.
---
 src/pulsecore/source-output.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 66a33bd..fafc226 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -255,9 +255,17 @@ int pa_source_output_new(
     pa_return_val_if_fail(!data->driver || pa_utf8_valid(data->driver), -PA_ERR_INVALID);
 
     if (!data->source) {
-        pa_source *source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE);
-        pa_return_val_if_fail(source, -PA_ERR_NOENTITY);
-        pa_source_output_new_data_set_source(data, source, false);
+        pa_source *source;
+
+        if (data->direct_on_input) {
+            source = data->direct_on_input->sink->monitor_source;
+            pa_return_val_if_fail(source, -PA_ERR_INVALID);
+            pa_source_output_new_data_set_source(data, source, false);
+        } else {
+            source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE);
+            pa_return_val_if_fail(source, -PA_ERR_NOENTITY);
+            pa_source_output_new_data_set_source(data, source, false);
+        }
     }
 
     /* Routing's done, we have a source. Now let's fix the format and set up the
-- 
1.8.1.2



More information about the pulseaudio-discuss mailing list