aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/lib/bluealsa/hal-bluealsa-transports.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2019-01-23 11:27:03 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-02-07 13:01:27 +0000
commit779366b7d9f0e16478a4c15387e26d29b6ba522e (patch)
treed071f7cd8ccf51f1afed3f100e0f25e64df02778 /plugins/lib/bluealsa/hal-bluealsa-transports.c
parent48cd4335d91c1341df94e48ca3ea07dbf418bccc (diff)
bluealsa plugin: monitor the state of service via dbus
By monitoring the changes of names on dbus, and by asking dbus for the list of available names at startup, the bluealsa plugin can now be started at whatever time, and is also robust to bluealsa restarts. Moreover, since the bluealsa name has the HCI interface has a suffix (org.bluez-alsa.hci0, for instance), there is not need to hardcode the hci name. Even better, the plugin supports several instances of bluealsa (since the daemon needs one instace per hci device), and will add a watch for added transports for every instance it detects. Complete cleanup of the created streams in softmixer is done when one watched instance disappears. Finnaly, there is a new cmd line '-DWITHOUT_BLUEALSA' option to CMake, for developpers that want to use 4A on host, without the bluealsa library. Default build (SDK, bitbake) consider that the bluealsa shared library is always available. Notice that in the future, the bluealsa library might disappeared, to be replaced by a full dbus interface to bluealsa. BUG-AGL:SPEC-2126 Change-Id: I67fc6edf5147c71dc97f1fc1257d3dadbdde20fc Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> (cherry picked from commit fbad8c202c86e4cf6503a99161aabf87ab7a7109)
Diffstat (limited to 'plugins/lib/bluealsa/hal-bluealsa-transports.c')
-rw-r--r--plugins/lib/bluealsa/hal-bluealsa-transports.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/lib/bluealsa/hal-bluealsa-transports.c b/plugins/lib/bluealsa/hal-bluealsa-transports.c
index 56e1a29..590ab5d 100644
--- a/plugins/lib/bluealsa/hal-bluealsa-transports.c
+++ b/plugins/lib/bluealsa/hal-bluealsa-transports.c
@@ -74,6 +74,7 @@ bool halBlueAlsaTransportFind(
}
+
int halBlueAlsaTransportUpdate(
const bluealsa_watch * watch,
bluealsa_transport_t * list,
@@ -129,7 +130,8 @@ static bool halBlueAlsaTransportMatch(const struct ba_msg_transport * transport1
if (transport1->type != transport2->type)
goto done;
- if (transport1->stream != transport2->stream)
+ /* with HFP/ofono, a NULL codec means a hangup. So we consider that the transport has disappeared in that case */
+ if (transport1->codec != transport2->codec)
goto done;
if (bacmp(&transport1->addr, &transport2->addr) != 0) {
@@ -146,8 +148,8 @@ char * halBlueAlsaTransportAsString(char * buff, size_t len, const struct ba_msg
ba2str(&transport->addr, addr);
snprintf(buff, len, "%s,%s,%s", addr,
- transport->type == BA_PCM_TYPE_A2DP?"a2dp":"sco",
- transport->stream == BA_PCM_STREAM_PLAYBACK?"playback":"capture");
+ transport->type & BA_PCM_TYPE_A2DP?"a2dp":"sco",
+ transport->type & BA_PCM_STREAM_PLAYBACK?"playback":"capture");
return buff;
}