From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/9 v3] audio: Fix handling of A2DP suspend indication
Date: Fri, 15 Jun 2012 17:41:34 +0300 [thread overview]
Message-ID: <1339771301-24032-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1339771301-24032-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When accepting the suspend indication all callbacks should be notified
that suspend completed.
In addition to this fix not using avdtp_start return in indication
callback as well as in the confirmation.
---
audio/a2dp.c | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/audio/a2dp.c b/audio/a2dp.c
index cc8f139..fa97645 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -986,6 +986,9 @@ static gboolean suspend_ind(struct avdtp *session, struct avdtp_local_sep *sep,
void *user_data)
{
struct a2dp_sep *a2dp_sep = user_data;
+ struct a2dp_setup *setup;
+ gboolean start;
+ int start_err;
if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK)
DBG("Sink %p: Suspend_Ind", sep);
@@ -999,6 +1002,30 @@ static gboolean suspend_ind(struct avdtp *session, struct avdtp_local_sep *sep,
a2dp_sep->session = NULL;
}
+ if (!a2dp_sep->suspending)
+ return TRUE;
+
+ a2dp_sep->suspending = FALSE;
+
+ setup = find_setup_by_session(session);
+ if (!setup)
+ return TRUE;
+
+ start = setup->start;
+ setup->start = FALSE;
+
+ finalize_suspend(setup);
+
+ if (!start)
+ return TRUE;
+
+ start_err = avdtp_start(session, a2dp_sep->stream);
+ if (start_err < 0) {
+ error("avdtp_start: %s (%d)", strerror(-start_err),
+ -start_err);
+ finalize_setup_errno(setup, start_err, finalize_resume);
+ }
+
return TRUE;
}
@@ -1009,7 +1036,7 @@ static void suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
struct a2dp_sep *a2dp_sep = user_data;
struct a2dp_setup *setup;
gboolean start;
- int perr;
+ int start_err;
if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK)
DBG("Sink %p: Suspend_Cfm", sep);
@@ -1040,10 +1067,11 @@ static void suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
return;
}
- perr = avdtp_start(session, a2dp_sep->stream);
- if (perr < 0) {
- error("Error on avdtp_start %s (%d)", strerror(-perr), -perr);
- finalize_setup_errno(setup, -EIO, finalize_suspend, NULL);
+ start_err = avdtp_start(session, a2dp_sep->stream);
+ if (start_err < 0) {
+ error("avdtp_start: %s (%d)", strerror(-start_err),
+ -start_err);
+ finalize_setup_errno(setup, start_err, finalize_suspend, NULL);
}
}
--
1.7.10.2
next prev parent reply other threads:[~2012-06-15 14:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 14:41 [PATCH BlueZ 1/9 v3] audio: Add handling of AVDTP command collision Luiz Augusto von Dentz
2012-06-15 14:41 ` Luiz Augusto von Dentz [this message]
2012-06-15 14:41 ` [PATCH BlueZ 3/9 v3] audio: Fix handling of A2DP open indication Luiz Augusto von Dentz
2012-06-15 14:41 ` [PATCH BlueZ 4/9 v3] audio: Fix handling of A2DP start indication Luiz Augusto von Dentz
2012-06-15 14:41 ` [PATCH BlueZ 5/9 v3] audio: Fix handling of A2DP abort indication Luiz Augusto von Dentz
2013-01-21 14:53 ` Chan-yeol Park
2012-06-15 14:41 ` [PATCH BlueZ 6/9 v3] audio: Wait remote side to send AVDTP_START when acting as acceptor Luiz Augusto von Dentz
2012-06-15 14:41 ` [PATCH BlueZ 7/9 v3] AVDTP: Do not respond ABORT command with invalid id Luiz Augusto von Dentz
2012-06-15 14:41 ` [PATCH BlueZ 8/9 v3] AVDTP: Fix responding to ABORT with reject Luiz Augusto von Dentz
2012-06-15 14:41 ` [PATCH BlueZ 9/9 v3] audio: Fix aborting A2DP setup while AVDTP_START is in progress Luiz Augusto von Dentz
2012-06-15 14:52 ` [PATCH BlueZ 1/9 v3] audio: Add handling of AVDTP command collision Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339771301-24032-2-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).