[pulseaudio-discuss] [PATCH] sink/source: lower priority of phone sinks/sources

Georg Chini georg at chini.tk
Fri Sep 1 14:21:34 UTC 2017


When a phone is connected via bluetooth and switches to HFP, the sinks
and sources will have higher priority than the built-in devices.
Therefore they are chosen as default and module-bluetooth-policy will
incorrectly insert loopback modules that loop the phone back to itself.

This patch fixes the problem by lowering the priority of devices with
the form factor "phone" so that they are never chosen as default sink
or source unless no other sound device is available.
---
 src/pulsecore/sink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a8b4cd3d..e1bd5a08 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -3529,6 +3529,8 @@ unsigned pa_device_init_priority(pa_proplist *p) {
             priority += 450;
         else if (pa_streq(s, "internal"))
             priority += 400;
+        else if (pa_streq(s, "phone"))
+            priority -= 1000;
     }
 
     if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_BUS))) {
-- 
2.11.0



More information about the pulseaudio-discuss mailing list