switch-on-port-available: checking the off profile when switching profile
authorHui Wang <hui.wang@canonical.com>
Thu, 20 Aug 2020 08:21:08 +0000 (16:21 +0800)
committerTanu Kaskinen <tanuk@iki.fi>
Mon, 18 Jan 2021 17:51:49 +0000 (17:51 +0000)
commit6d41b93cdb011a08d01770624a8fe5bb9720b586
treefd3c6c3b7c8184f83ad1e9b1c5621c82e9b7614e
parent33c89b6b76f0d2ea25746ee2cbfa682e138f9ced
switch-on-port-available: checking the off profile when switching profile

If the current active profile is off, it has no sinks and sources, and
if users plug a headset to the audio port, the profile including this
audio port becomes available and should be selected as active profile.

But with the current design, the profile_good_for_output() will return
false because the sources in off profile and target profile doesn't
match.

For example:
(Before users plug headset)
Profiles:
         HiFi (Speaker): Default (sinks: 1, sources: 1, priority: 8100, available: no)
         HiFi (Headphones): Default (sinks: 1, sources: 1, priority: 8200, available: no)
         off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off

(After users plug headset)
Profiles:
         HiFi (Speaker): Default (sinks: 1, sources: 1, priority: 8100, available: yes)
         HiFi (Headphones): Default (sinks: 1, sources: 1, priority: 8200, available: yes)
         off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/354>
src/modules/module-switch-on-port-available.c