[pulseaudio-discuss] patch: fix JACK source/sink backwards

Andrew Kelley superjoe30 at gmail.com
Tue Jul 28 22:44:21 PDT 2015


Screenshot of problem: http://i.imgur.com/ENpSCoG.png

I believe by default the PulseAudio JACK Sink and PulseAudio JACK Source
are switched around.

In PulseAudio lingo, "Sink" means an output device, and "Source" means an
input device. Yet, the Sink is registered as a readable client and the
Source is registered as a writable client, which is backwards.

I think this happened because when you register a port,
JackPortIsOutput/JackPortIsInput is relative to the server, not the client.
See:
https://github.com/jackaudio/example-clients/blob/master/simple_client.c#L121

Indeed, applications are happily outputting to PulseAudio, but they go
silent when I turn the JACK server on. This is explained by my hypothesis
above.

>From caa7fcf266384cfe3413b9dfd60d6a5480112329 Mon Sep 17 00:00:00 2001
From: Andrew Kelley <superjoe30 at gmail.com>
Date: Tue, 28 Jul 2015 22:40:40 -0700
Subject: [PATCH] JACK module: fix input and output swapped

JackPortIsInput and JackPortIsOutput are relative to the
server, not the client.
---
 src/modules/jack/module-jack-sink.c   | 2 +-
 src/modules/jack/module-jack-source.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/jack/module-jack-sink.c
b/src/modules/jack/module-jack-sink.c
index 38ba9ba..3d55c04 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -372,7 +372,7 @@ int pa__init(pa_module*m) {
     pa_assert(pa_sample_spec_valid(&ss));

     for (i = 0; i < ss.channels; i++) {
-        if (!(u->port[i] = jack_port_register(u->client,
pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput|JackPortIsTerminal, 0))) {
+        if (!(u->port[i] = jack_port_register(u->client,
pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput|JackPortIsTerminal, 0))) {
             pa_log("jack_port_register() failed.");
             goto fail;
         }
diff --git a/src/modules/jack/module-jack-source.c
b/src/modules/jack/module-jack-source.c
index 1130947..99441ff 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -319,7 +319,7 @@ int pa__init(pa_module*m) {
     pa_assert(pa_sample_spec_valid(&ss));

     for (i = 0; i < ss.channels; i++) {
-        if (!(u->port[i] = jack_port_register(u->client,
pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput|JackPortIsTerminal, 0))) {
+        if (!(u->port[i] = jack_port_register(u->client,
pa_channel_position_to_string(map.map[i]), JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput|JackPortIsTerminal, 0))) {
             pa_log("jack_port_register() failed.");
             goto fail;
         }
-- 
2.4.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150729/e36e3532/attachment.html>


More information about the pulseaudio-discuss mailing list