[pulseaudio-discuss] [PATCH v12 11/13] bluetooth: policy: Reflect a2dp profile names

Pali Rohár pali.rohar at gmail.com
Fri Jul 5 13:02:24 UTC 2019


In next patches, codec name is appended end the end of a2dp profile names.
---
 src/modules/bluetooth/module-bluetooth-policy.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index 0a6d59d28..04313aa84 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -85,7 +85,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
     if (!s)
         return PA_HOOK_OK;
 
-    if (u->enable_a2dp_source && pa_streq(s, "a2dp_source"))
+    if (u->enable_a2dp_source && pa_startswith(s, "a2dp_source"))
         role = "music";
     else if (u->enable_ag && pa_streq(s, "headset_audio_gateway"))
         role = "phone";
@@ -154,7 +154,7 @@ static void card_set_profile(struct userdata *u, pa_card *card, bool revert_to_a
 
         /* Check for correct profile based on revert_to_a2dp */
         if (revert_to_a2dp) {
-            if (!pa_streq(profile->name, "a2dp_sink"))
+            if (!pa_startswith(profile->name, "a2dp_sink"))
                 continue;
         } else {
             if (!pa_streq(profile->name, "headset_head_unit"))
@@ -196,11 +196,11 @@ static void switch_profile(pa_card *card, bool revert_to_a2dp, void *userdata) {
             return;
 
         /* Skip card if already has active a2dp profile */
-        if (pa_streq(card->active_profile->name, "a2dp_sink"))
+        if (pa_startswith(card->active_profile->name, "a2dp_sink"))
             return;
     } else {
         /* Skip card if does not have active a2dp profile */
-        if (!pa_streq(card->active_profile->name, "a2dp_sink"))
+        if (!pa_startswith(card->active_profile->name, "a2dp_sink"))
             return;
 
         /* Skip card if already has active hsp profile */
@@ -307,7 +307,7 @@ static pa_hook_result_t card_init_profile_hook_callback(pa_core *c, pa_card *car
 
     /* Ignore card if has already set other initial profile than a2dp */
     if (card->active_profile &&
-        !pa_streq(card->active_profile->name, "a2dp_sink"))
+        !pa_startswith(card->active_profile->name, "a2dp_sink"))
         return PA_HOOK_OK;
 
     /* Set initial profile to hsp */
@@ -359,7 +359,7 @@ static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_prof
         return PA_HOOK_OK;
 
     /* Do not automatically switch profiles for headsets, just in case */
-    if (pa_streq(profile->name, "a2dp_sink") || pa_streq(profile->name, "headset_head_unit"))
+    if (pa_startswith(profile->name, "a2dp_sink") || pa_streq(profile->name, "headset_head_unit"))
         return PA_HOOK_OK;
 
     is_active_profile = card->active_profile == profile;
-- 
2.11.0



More information about the pulseaudio-discuss mailing list