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

Arun Raghavan arun at arunraghavan.net
Thu Feb 2 07:32:22 UTC 2017


On Tue, 31 Jan 2017, at 08:01 PM, Tanu Kaskinen wrote:
> 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.

This rationale seems to suggest dropping the sink priority altogether
and just using the port priority by default (with a default, low
priority for sinks without any ports)?

I realise this might be more work (quick grep suggests that most if it
is around the alsa module bits), but it feels like not having the basic
concept behind these  clearly defined will make this harder to reason
about in the future.

-- Arun


More information about the pulseaudio-discuss mailing list