4A PCM crashes depending of the PCM order
Description
Environment
Activity
Loïc Collignon [ IoT.bzh ] July 26, 2018 at 1:55 PM
Pulse audio is now disabled by default, also Collabora is developping a 4a-pulseaudio plugin.
Sebastien Douheret February 23, 2018 at 9:47 AM
This bug will be fixed if Pulse Audio is not used aside 4A or if we develop a 4A->Pulse audio plugin.
Tai Vuong December 12, 2017 at 12:48 AM
Re-Assign to Ronan because the fix should be done on the system level instead of 4A.
Tai Vuong December 12, 2017 at 12:47 AM(edited)
1) speaker-test use case
4A Policy module by design will denied access to a stream when a higher priority stream is already playing on the requested device.
This behaviour is implement explicitly to support ducking and stream management. This explain why doing the following tests:
speaker-test -DEmergency-c2 -twav
speaker-test -DMultimedia -c2 -twav
The second speaker-test command will fail, It is an expected behaviour by design.
2) PulseAudio use case
PulseAudio failure is caused by the way PulseAudio handle load-module.
PulseAudio will try to open and close streams during the loading of the alsa module.
Combine with ALSA hook, this result in requesting an open stream to 4A Policy module.
When multiple "load-module module-alsa-sink" are configure inside PulseAudio configuration files, this result in multiple simultaneously open stream request .
This will lead to lower priority stream being denied access and lead to PulseAudio failing on init.
Conclusion and recommendations
In the first use case, no fix is needed. This is by design.
In the second use case, the fix should be done on the system level rather than inside 4A.
4A does not know if the request come from PulseAudio init sequence or a real open stream request.
PulseAudio should be configure to sequentially load module-alsa-sink. This could be achieved by a systemd service for example.
If the priority of the previous PCM launched, is higher than the next PCM, the next PCM will failed.
Test:
On Pulseaudio
1) order:
load-module module-alsa-sink device=Fallback
load-module module-alsa-sink device=Emergency
Result:
Pulse audio OK
2) order:
load-module module-alsa-sink device=Emergency
load-module module-alsa-sink device=Fallback
Result:
Pulse audio KO
ON Alsa:
Run this 2 commands simultaneously, by order:
1)
speaker-test -DMultimedia -c2 -twav
speaker-test -DEmergency -c2 -twav
Result: OK
2)
speaker-test -DEmergency-c2 -twav
speaker-test -DMultimedia -c2 -twav
Result: KO