[pulseaudio-discuss] RFC: Routing and Priority lists
Colin Guthrie
gmane at colin.guthr.ie
Thu Nov 24 13:24:13 PST 2011
'Twas brillig, and Janos Kovacs at 22/11/11 21:14 did gyre and gimble:
> Hi,
>
> so far we were talking of the simpler routing scenarios. So let's shift to
> the next gear and discuss the more challenging setup's.
>
> In some cases we might have multiple zones, e.g a desktop PC
> were in one room and a stereo amplifier would be in another
> connected via S/PDIF. Say you want to do the usual stuff and
> see youtube videos in one room, while playing out music to the
> other room.
>
> Let's forget for a moment about that there is no profile with dual sink
> and focus on the possible routing issues.
>
> How would our media role based routing work? Both streams
> media role would be 'music' so it could not be used to select the
> sink.
>
> One option would be to add a property to the streams what would
> tell the 'zone'. The lack of property would default to a certain zone.
> That would be a natural thing from the application perspective but
> would break the currently proposed routing infrastructure.
>
> The other option would be to follow the bad example of profiles
> and have media roles like 'music' , 'music-in-zone2' etc. This
> thing would work with the proposed routing infrastructure but ...
>
> So any thoughts on this?
>
> We might need this for IVI scenarios, when different movies
> watched on the backseat of a car.
In my proposal, priority lists are purely based on modules. So as well
as "role based routing", you could also have "zone based routing" via a
simple additional module.
In particular look at the section on the wiki page that starts "If a
given module wants to do a more complicated "lookup key", they can
simply do something like"
Now we have to assume that a "media.zone" type attribute is added
somehow via some kind of mechanism or we can otherwise determine the
required zone of certain apps, but I think this is pretty much a
prerequisite of your initial premise anyway? (if we're talking about a
desktop ssytem, perhaps you "zone" your virtual desktops/workspaces such
that apps on one virtual desktop automatically propagate their zone to
the PA streams - either way we can assume that's something done outside
the routing logic per-se)
Anyway, we could assume there was a "module-zone-routing" module that
operated at a higher weighting than the "module-role-routing" module,
meaning our zones will be consulted before our roles.
In a simple setup this works OK. e.g. if the spdif is in zone2, we
simply have some device+ports in the list for the zone2 key, but have no
device+ports attached to the zone1 key. Therefore any stream that has
zone1 metadata, will always be played on the zone one devices regardless
of it's role, but as there is no data for zone1 in the zone list, it'll
just fall through to standard zone-based routing.
If you wanted each zone-role combo to have it's very own priority list
you would simply do what I described in the wiki page section I
referenced above. That is you'd add a hook that looks for new streams or
when priority lists on streams change and then create a composite entry
in the proplist called e.g. "media.role-zone" which is just the
concatenation of the media.role and media.zone values. You then register
a priority list with the code:
pa_priority_list_register(core, "role-zone-sink", "Role+Zone Playback",
"media.role-zone", PA_DEVICE_TYPE_SINK, 4000);
Now obviously this is getting a little convoluted, but the net result is
effectively a different priority list for each role in each zone.
You highlighted in your example that this is possible with the proposed
solution, so I'm sure this isn't news to you, but I thought I'd spell it
out for clarity!
Overall I think it's pretty convoluted, but then the problem itself is
also quite convoluted. I'm not sure that designing the solution with
some additional level of "zoning" built in would help. As Tanu suggested
in another email, it's already a rather complex solution (I'd say it's
as complex as it needs to be*, but I wouldn't want to make it any more
complex!), so I think a composite role+zone system to solve this problem
would be an acceptable way to achieve it.
Cheers
Col
*The previously mentioned required complexity of determining the order
of the streams in the outer loop not withstanding!
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the pulseaudio-discuss
mailing list