lbalhar / rpms / pulseaudio

Forked from rpms/pulseaudio 4 years ago
Clone
Blob Blame History Raw
From 9b2902b6dc2f75cf596432cc23ec2dc7468a1cf4 Mon Sep 17 00:00:00 2001
From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Date: Mon, 11 Aug 2014 12:47:46 +0300
Subject: [PATCH 19/31] bluetooth: Always initialize profile->available

If the transport for the profile doesn't exist, the old behaviour was
to leave cp->available at the default value, which is
PA_AVAILABLE_UNKNOWN, but if there's no transport, the profile should
be marked as unavailable.
---
 src/modules/bluetooth/module-bluez5-device.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index 5398a1b..fdf4078 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1755,8 +1755,12 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
         *p = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY;
     }
 
-    if (cp && u->device->transports[*p])
-        cp->available = transport_state_to_availability(u->device->transports[*p]->state);
+    if (cp) {
+        if (u->device->transports[*p])
+            cp->available = transport_state_to_availability(u->device->transports[*p]->state);
+        else
+            cp->available = PA_AVAILABLE_NO;
+    }
 
     return cp;
 }
-- 
1.9.3