summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-06-15 17:41:38 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-15 17:50:01 +0300
commit34d9bd7dd27281cae1d2f9325947241e31819f18 (patch)
treeca226b0e8c4c436b64f29b57a2048758ae427460
parent4503dba4ba28299c83aa320a95e988c74b67eaa8 (diff)
downloadbluez-34d9bd7dd27281cae1d2f9325947241e31819f18.tar.gz
audio: Wait remote side to send AVDTP_START when acting as acceptor
Some devices like Sony Ericsson MW600 reject AVDTP_START if it was the initiator of the connection, apparently it follows recommendation 12 of simultaneous use of HFP, A2DP and AVRCP profiles white paper which says: "If the RD has configured and opened a stream it is also responsible to start the streaming via GAVDP_START." If the client is fast enough and try to acquire the transport this cause an error, so instead of sending AVDTP_START the code now checks if it is the acceptor of the stream and wait the remote side to send the command.
-rw-r--r--audio/avdtp.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 12876984f..736eed751 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1068,12 +1068,19 @@ static void avdtp_sep_set_state(struct avdtp *session,
break;
case AVDTP_STATE_OPEN:
stream->starting = FALSE;
- if (old_state > AVDTP_STATE_OPEN && session->auto_dc)
+ if ((old_state > AVDTP_STATE_OPEN && session->auto_dc) ||
+ stream->open_acp)
stream->idle_timer = g_timeout_add_seconds(STREAM_TIMEOUT,
stream_timeout,
stream);
break;
case AVDTP_STATE_STREAMING:
+ if (stream->idle_timer) {
+ g_source_remove(stream->idle_timer);
+ stream->idle_timer = 0;
+ }
+ stream->open_acp = FALSE;
+ break;
case AVDTP_STATE_CLOSING:
case AVDTP_STATE_ABORTING:
if (stream->idle_timer) {
@@ -3660,6 +3667,15 @@ int avdtp_start(struct avdtp *session, struct avdtp_stream *stream)
if (stream->lsep->state != AVDTP_STATE_OPEN)
return -EINVAL;
+ /* Recommendation 12:
+ * If the RD has configured and opened a stream it is also responsible
+ * to start the streaming via GAVDP_START.
+ */
+ if (stream->open_acp) {
+ stream->starting = TRUE;
+ return 0;
+ }
+
if (stream->close_int == TRUE) {
error("avdtp_start: rejecting start since close is initiated");
return -EINVAL;