pulseaudio/src
Hui Wang ab6a714cd1 alsa-card: add dynamic priority bonus base for alsa profiles
After applying the commit 0d50e787 ("alsa-card: improve the profile
availability logic"), we met an new issue. when system selects the
initial profile, the profile off is selected instead of a profile with
a valid output device on it. That is the issue we met:

Profiles:
  HiFi: Default (sinks: 2, sources: 2, priority: 8000, available: no)
  off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off
Ports:
  [Out] Headphones: Headphones (priority: 300, latency offset: 0 usec, not available)
   Part of profile(s): HiFi
  [Out] Speaker: Speaker (priority: 100, latency offset: 0 usec)
   Part of profile(s): HiFi
...

I know the commit 0d50e787 really fixed something, but we still need
to fix the new issue, to do so, this patch introduces a priority bonus
for alsa profiles and separate the alsa profiles to 3 groups:
group a (will be granted priority bonus dynamically):
a profile has only output ports and at least one port is not unavailable
a profile has only input ports and at least one port is not unavailable
a profile has both input and output ports, and at least one output and
one input ports are not unavailable

group b (will be marked unavailable)
a profile has only output ports and all ports are unavailable
a profile has only input ports and all ports are unavailable
a profile has both output and input ports, and all ports are unavailable

group c
the rest profiles, their priority and availability is not changed.

With this change, the profile HiFi will become avaialbe:yes, and will
not be granted priority bonus if no input port is plugged.

The priority bonus provides a higher priority base to profiles, this
guarantees this patch doesn't break the fix of 0d50e787.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/927

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/355>
2021-01-17 12:28:51 +00:00
..
daemon database: clean up remaining references to CANONICAL_HOST 2021-01-07 23:27:16 +00:00
modules alsa-card: add dynamic priority bonus base for alsa profiles 2021-01-17 12:28:51 +00:00
pulse win32: Fix format specifiers for DWORD values 2021-01-13 03:42:24 +00:00
pulsecore win32: Fix format specifiers for DWORD values 2021-01-13 03:42:24 +00:00
tests alsa-mixer: Respect XDG base directory spec when loading path configs 2020-12-14 19:25:12 +00:00
utils win32: Fix meson build system for Windows. 2020-12-16 11:05:28 -05:00
.gitignore gitignore: Ignore hashmap-test 2020-08-06 14:34:56 +03:00
depmod.py update FSF addresses to FSF web page 2015-01-14 22:20:40 +02:00
Makefile.am win32: Fix WSAStartup issues 2021-01-13 03:16:06 +00:00
map-file message-params: Add read functions for arrays 2020-12-03 14:41:39 +00:00
meson.build win32: Fix meson build system for Windows. 2020-12-16 11:05:28 -05:00