[pulseaudio-discuss] [PATCH 3/3] sink, source: copy priority from active port

Tanu Kaskinen tanuk at iki.fi
Tue Jan 31 14:31:04 UTC 2017


On Mon, 2017-01-30 at 14:54 +0530, Arun Raghavan wrote:
> On Thu, 8 Sep 2016, at 04:36 PM, Tanu Kaskinen wrote:
> > It was reported in bug 93006 that on hardware that has HDMI and analog
> > outputs on different cards, the HDMI sink is chosen by default even when
> > headphones are plugged in. The headphone port has higher priority than
> > the HDMI port, but that is not reflected in the sink priorities. This
> > patch changes that - the sink/source priority is now the same as the
> > active port priority, unless the sink/source doesn't have any ports, in
> > which case the old priority logic is retained.
> > 
> > BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93006
> > ---

As discussed in IRC, the analog sink should already have a higher
priority than the HDMI sink, so this patch shouldn't be needed to solve
the original problem. I don't know why HDMI was being preferred over
the analog sink. I still think the change is good, however.

> I don't agree with this approach -- it conflates the priority values of
> two different objects, which IMO is wrong.
> 
> I think we should adjust the sink priorities independently to make sure
> we get the default setup that we want.

Let's say there are two sinks, sink1 and sink2. Their active ports are
port1 and port2, respectively. Can you think of any situation where
you'd want to have higher priority on sink1 than sink2, if the priority
of port2 is higher than the priority of port1?

Here's a more contrived example:

sink1 has ports port1 and port3. Port1's priority is 1 and port3's
priority is 3.

sink2 has port2. port2's priority is 2.

When sink1's active port is port3, I'd want PulseAudio to use sink1,
because it has a better port than sink2. When port3 is unavailable and
sink1's active port is port1, I'd want PulseAudio to use sink2 by
default. If the sink priorities don't change when the port changes,
sink1 will always have a higher priority than sink2 or vice versa, so
the default sink will unavoidably be wrong some of the time.

Note that sink priorities are not used for anything else than choosing
the default sink. Clients don't use the sink priorities either, because
the sink priorities are not exported to the client API.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list