[RFC v2 3/6] bluetooth: Restrict loopback to hfgw and a2dp_source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/modules/bluetooth/module-bluetooth-policy.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index c9639f5..e542d97 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -82,6 +82,14 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void*
             return PA_HOOK_OK;
     }
 
+    /* Restrict to A2DP sink role and HFP HF role */
+    if ((s = pa_proplist_gets(sink->proplist, "bluetooth.protocol"))) {
+        if (!pa_streq(s, "hfgw") && !pa_streq(s, "a2dp_source")) {
+            pa_log_debug("Profile %s cannot be selected for loopback", s);
+            return PA_HOOK_OK;
+        }
+    }
+
     /* Prevent loopback default source over default sink */
     defsink = pa_namereg_get_default_sink(c);
     if (defsink == sink) {
@@ -143,6 +151,14 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
             return PA_HOOK_OK;
     }
 
+    /* Restrict to A2DP sink role and HFP HF role */
+    if ((s = pa_proplist_gets(source->proplist, "bluetooth.protocol"))) {
+        if (!pa_streq(s, "hfgw") && !pa_streq(s, "a2dp_source")) {
+            pa_log_debug("Profile %s cannot be selected for loopback", s);
+            return PA_HOOK_OK;
+        }
+    }
+
     /* Prevent loopback default source over default sink */
     defsource = pa_namereg_get_default_source(c);
     if (defsource == source) {
-- 
1.7.5.4



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux