From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [RFC v5 3/4] media: Automatically release transport when HUP
Date: Fri, 14 Sep 2012 14:55:59 +0200 [thread overview]
Message-ID: <1347627360-13997-4-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1347627360-13997-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
When the remote end suspends the audio stream, release the transport
automatically without waiting until the clients call Release().
This affects the D-Bus API since clients will get an error when trying
to release the transport afterwards.
However, this should have no real impact, since most clients (i.e.
PulseAudio) would just log some error trace but otherwise ignore the
issue.
---
audio/transport.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/audio/transport.c b/audio/transport.c
index 742cc72..4653cc7 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -60,7 +60,7 @@ typedef enum {
TRANSPORT_STATE_IDLE, /* Not acquired and suspended */
TRANSPORT_STATE_PENDING, /* Playing but not acquired */
TRANSPORT_STATE_REQUESTING, /* Acquire in progress */
- TRANSPORT_STATE_ACTIVE, /* Acquired (not necessarily playing) */
+ TRANSPORT_STATE_ACTIVE, /* Acquired and playing */
TRANSPORT_STATE_SUSPENDING, /* Release in progress */
} transport_state_t;
@@ -1178,6 +1178,18 @@ static void transport_update_playing(struct media_transport *transport,
if (playing == FALSE) {
if (transport->state == TRANSPORT_STATE_PENDING)
transport_set_state(transport, TRANSPORT_STATE_IDLE);
+ else if (transport->state == TRANSPORT_STATE_ACTIVE) {
+ /* Remove all owners */
+ while (transport->owners != NULL) {
+ struct media_owner *owner;
+
+ owner = transport->owners->data;
+ media_transport_remove(transport, owner);
+ }
+
+ /* Suspend so that the locks get released */
+ transport->suspend(transport, NULL);
+ }
} else if (transport->state == TRANSPORT_STATE_IDLE)
transport_set_state(transport, TRANSPORT_STATE_PENDING);
}
--
1.7.7.6
next prev parent reply other threads:[~2012-09-14 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-14 12:55 [RFC v5 0/4] Optional acquire in Media API and related Mikel Astiz
2012-09-14 12:55 ` [RFC v5 1/4] media: Split transport state based on playing flag Mikel Astiz
2012-09-14 12:55 ` [RFC v5 2/4] media: Expose transport state in D-Bus Mikel Astiz
2012-09-14 12:55 ` Mikel Astiz [this message]
2012-09-14 12:56 ` [RFC v5 4/4] media: Extend media API with optional acquire Mikel Astiz
2012-09-17 13:33 ` [RFC v5 0/4] Optional acquire in Media API and related Luiz Augusto von Dentz
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=1347627360-13997-4-git-send-email-mikel.astiz.oss@gmail.com \
--to=mikel.astiz.oss@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz@bmw-carit.de \
/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