diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-09-14 14:55:59 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-09-17 16:27:06 +0300 |
commit | 75b10ebb1543707a28d2a4736f613be609ea292d (patch) | |
tree | fa16101f527a7238842ea25da2a6d066f3630f15 /audio | |
parent | 3edd39f0fd42686d0b1260525ae9778ef798f806 (diff) | |
download | bluez-75b10ebb1543707a28d2a4736f613be609ea292d.tar.gz |
media: Automatically release transport when HUP
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.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/transport.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/audio/transport.c b/audio/transport.c index 742cc72db..934bf3757 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,15 @@ 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); + } + } } else if (transport->state == TRANSPORT_STATE_IDLE) transport_set_state(transport, TRANSPORT_STATE_PENDING); } |