Hello, I've been working on porting PulseAudio to Android on the OMAP4-based Galaxy Nexus, and have recently looking at the policy-bits. The basic porting has been greatly simplified with Wei Feng's work to renew PulseAudio UCM integration and Liam's help with fixing up some of the UCM config for the Galaxy Nexus. I am, however, facing some trouble mapping how the hardware is used to how UCM presents it (or, perhaps, the UCM-PA mapping does).
Some simplified background: the devices of interest on the OMAP4 SoC are the main hifi PCM which can be routed to various outputs, the modem PCM which is not used for actual output but to enable use of the modem during calls, and the tones PCM which is intended to be used for playing ringtones, aiui.
The first problem is mutual exclusivity of verbs. From what I can understand, verbs are intended to be mutually exclusive -- if you have a HiFi verb and a VoiceCall verb, only one may be used at a time. We have mapped verbs to card profiles, which offer the same guarantee. However, on Android (which is a fair example of the kind of audio policy we might want), the HiFi verb PCMs maybe used while the VoiceCall PCMs are open. This is done, for example, to play an end-of-call tone from the CPU while the modem PCMs are still held open. Is there some way to do this with UCM?
The second problem is having separate PCMs for modifiers. In the OMAP4 profile, ringtone playback is exposed via a PlayTone modifier which corresponds to a separate PCM from regular HiFi playback. In the UCM-PA mapping we decided on, modifiers were implemented as device intended roles on a sink, so that when a stream with that role came in, we could enable the modifier, and disable it when such a stream ends. However, this doesn't account for switching the PCM on which playback is occurring. Should we be creating a separate sink for such modifiers (with lower priority, so they're not routed to unless there's a stream with the required role coming in)? Or should we be reopening the PCM for this?
Finally, a question also related to modifiers -- is it expected that there will never be a case where a stream that requires no modifier is being played while a stream that does require a modifier also exists? If not, what kind of policy should we have for enabling the modifier or not?
Cheers, Arun