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

Andrew Kelley superjoe30 at gmail.com
Tue Jul 28 23:30:32 PDT 2015

On Tue, Jul 28, 2015 at 11:15 PM Tanu Kaskinen <tanuk at iki.fi> wrote:

> On Wed, Jul 29, 2015, at 08:44, Andrew Kelley wrote:
> > Screenshot of problem: http://i.imgur.com/ENpSCoG.png
> I see no problem there.

> > 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.
> It's not backwards. Let's say that we have a music player that connects
> to pulseaudio. The user wants the audio from the music player to go to
> the speakers, and the speakers are under the control of jack. Inside
> PulseAudio there needs to be a sink where the music player's playback
> stream can connect. When the audio gets from the player to the sink, the
> next problem is to get the audio from the sink to the speakers, which
> are represented by two input ports in jack. In jack, audio flows from
> output ports to input ports, so PulseAudio needs to create two output
> ports. So, the audio flow becomes: music player -> (pulseaudio sink ->
> jack output ports) -> jack input ports. The part in parentheses
> represents the part that the jack sink module in PulseAudio implements.

After squinting my eyes for a few minutes, I see how it is supposed to
work, and it makes sense. I apologize for the mistake and taking your time.

This code was written many years ago; of course if there was such an
obvious problem someone would have seen it and fixed it by now.

> > 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.
> There is some other explanation for the silence. Do the applications get
> automatically moved to the jack sink?

This was a good clue, I looked at pavucontrol and switched the applications
to the JACK sink and the audio is correctly routed to the speakers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150729/b7a93232/attachment.html>

More information about the pulseaudio-discuss mailing list