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

Tanu Kaskinen tanuk at iki.fi
Tue Feb 7 12:54:53 UTC 2017

On Thu, 2017-02-02 at 13:02 +0530, Arun Raghavan wrote:
> On Tue, 31 Jan 2017, at 08:01 PM, Tanu Kaskinen wrote:
> > On Mon, 2017-01-30 at 14:54 +0530, Arun Raghavan wrote:
> > > 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.

The basic concept, as I see it, is that there are "outputs", and
portless sinks and ports are both instances of outputs. The priority is
a property of an output. Unfortunately, the code doesn't actually have
a concept of output that would cover both types, so we need to attach
the priority property to two types.

Dropping the sink priority should be quite easy, though. I can do that
if you really want - it will be easy enough to bring it back, if that
turns out to be necessary. The reason why we might want to bring it
back is that maybe we want to have different priorities with different
sinks. For example, a filter sink should probably have slightly higher
priority than the master sink. Currently we don't have such logic, so
there won't be any regressions caused by removing the sink priority



More information about the pulseaudio-discuss mailing list