PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
6d41b93c by Hui Wang at 2021-01-18T17:51:49+00:00
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 <[email protected]>
Part-of: 
<https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/354>

- - - - -


1 changed file:

- src/modules/module-switch-on-port-available.c


Changes:

=====================================
src/modules/module-switch-on-port-available.c
=====================================
@@ -71,6 +71,9 @@ static bool profile_good_for_output(pa_card_profile *profile, 
pa_device_port *po
 
     card = profile->card;
 
+    if (pa_safe_streq(card->active_profile->name, "off"))
+        return true;
+
     if (!pa_safe_streq(card->active_profile->input_name, profile->input_name))
         return false;
 
@@ -103,6 +106,9 @@ static bool profile_good_for_input(pa_card_profile 
*profile, pa_device_port *por
 
     card = profile->card;
 
+    if (pa_safe_streq(card->active_profile->name, "off"))
+        return true;
+
     if (!pa_safe_streq(card->active_profile->output_name, 
profile->output_name))
         return false;
 



View it on GitLab: 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6d41b93cdb011a08d01770624a8fe5bb9720b586

-- 
View it on GitLab: 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6d41b93cdb011a08d01770624a8fe5bb9720b586
You're receiving this email because of your account on gitlab.freedesktop.org.


_______________________________________________
pulseaudio-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits

Reply via email to