baseaudiosink: Add profile support for selecting the use case and automatically selecting a good default latency setting
Submitted by Pierre Bossart
Link to original bug (#641544)
Description
Created attachment 180113
alsasink bug fix
Audio sinks derived from baseaudiosink rely on default buffering and latency
settings, respectively 200 and 10ms. This is not good for media playback (too many interrupts) and not good for speech (too much latency).
The buffer-time and latency-time can be used to modify the default, but this is typically not enabled in applications.
Instead of using defaults that are not optimized for any application, the default should be to use the maximum latency in the audio backend. In case an application has strict latency requirements (speech calls or gaming) it needs to set buffer-time and latency-time to relevant values (as done by farsight)
This topic has been addressed a number of times on the mailing lists. See [1] for example.
You will find attached a set of patches to demonstrate the concept. I added a new MAX_LATENCY property in the baseaudiosink that is true by default. And I included alsasink and pulsesink changes to demonstrate how this can be used.
Note that the first patch is really an alsasink bug and should be applied no matter what the result of this discussion is
-Pierre
[1] https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-December/008470.html
Patch 180113, "alsasink bug fix":
0001-alsasink-fix-bug-with-period_time.patch