Do no process a stream as connected if AVDTP set configuration failed
RFC PATCH 1/1 Do no process a stream as connected if AVDTP set configuration failed
Right now, if set configuration fails then the sink.c:stream_setup_complete seems to consider the stream connected. So the DBus AudioSink.Connect() call returns without error. But the stream is not actually ready.
I have a feeling we may want to do some more cleanup, but this patch does the trick for us.
It is easy to reproduce the problem with the HTC BH S100. If you quickly disconnect and then reconnect it will return AVDTP set configuration failed (presumably because it hasn't closed the SEP on its end yet), but Dbus does not return an error for Connect.
The verbose hcid logs for this problem look like:
102 /system/bin/hcid I hcid[103]: avdtp_ref(0x145e8): ref=2 102 /system/bin/hcid I hcid[103]: Discovery complete 102 /system/bin/hcid I hcid[103]: a2dp_source_config: selected SEP 0x12100 102 /system/bin/hcid I hcid[103]: avdtp_ref(0x145e8): ref=3 102 /system/bin/hcid I hcid[103]: setup_ref(0x11930): ref=1 102 /system/bin/hcid I hcid[103]: avdtp_set_configuration(0x145e8): int_seid=1, acp_seid=1 102 /system/bin/hcid I hcid[103]: stream creation in progress 102 /system/bin/hcid I hcid[103]: session_cb 102 /system/bin/hcid I hcid[103]: SET_CONFIGURATION request rejected: Stream End Point in Use (19) 102 /system/bin/hcid I hcid[103]: Source 0x12100: Set_Configuration_Cfm 102 /system/bin/hcid I hcid[103]: setup_ref(0x11930): ref=2 102 /system/bin/hcid I hcid[103]: npelly 174
stream_setup_complete session=0x145e8 sep=0x120d8 stream=0x14ec0 err=0xbeea8aa4 user_data=0x13de8
102 /system/bin/hcid I hcid[103]: Stream successfully created
Quoted 1 line
From
47866d9e0e9596b8682293f601d195ef390bfd87Mon Sep 17 00:00:00 2001
From: Nick Pelly <[email protected]>
Date: Fri, 6 Mar 2009 16:53:04 -0800
Subject: [PATCH] Do not process stream as connected if AVDTP set configuration failed.
--- audio/sink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
audio/sink.c +0 -0
@@ -191,7 +191,7 @@ static void stream_setup_complete(struct avdtp
*session, struct a2dp_sep *sep,
pending = sink->connect;
- if (stream) {
+ if (stream & !err) {
debug("Stream successfully created");
if (pending->msg) {Signature · 1 line
1.5.5
Hi Nick,
Quoted 5 lines · Nick Pelly
Right now, if set configuration fails then the sink.c:stream_setup_complete seems to consider the stream connected. So the DBus
AudioSink.Connect()call returns without error. But the stream is not actually ready.
Quoted 7 lines
I have a feeling we may want to do some more cleanup, but this patch does the trick for us.
It is easy to reproduce the problem with the HTC BH S100. If you quickly disconnect and then reconnect it will return AVDTP set configuration failed (presumably because it hasn't closed the SEP on its end yet), but Dbus does not return an error for Connect.
Thanks for the patch. I pushed a slightly modified fix since the callback should always get NULL for the stream if there was an error:
http://git.kernel.org/?p=bluetooth/bluez.git;a=commitdiff;h=8f619dd6228f1cfa750e562d4e2ea89396e8b4fd
Johan