diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-09-21 21:32:46 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-09-21 21:32:46 +0300 |
commit | d8fe64e3b955ef65144babbf351e946e6533c4eb (patch) | |
tree | d53437098650d29bcdd0822ee35dce311e7b8a5f | |
parent | 21b1a180f451272f18a572e0f07f17295cd1625f (diff) | |
download | bluez-d8fe64e3b955ef65144babbf351e946e6533c4eb.tar.gz |
Fix headset_suspend_stream behavior for invalid states
The headset_suspend_stream function should imediately fail if the headset
isn't connected or playing. This ensures that we return a proper error to
the unix socket client if the headset disconnect just before we receive a
STOP_STREAM request.
-rw-r--r-- | audio/headset.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index a33fec8e5..cf1ae61e3 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -2348,6 +2348,10 @@ unsigned int headset_suspend_stream(struct audio_device *dev, struct headset *hs = dev->headset; unsigned int id; + if (hs->state == HEADSET_STATE_DISCONNECTED || + hs->state == HEADSET_STATE_CONNECTING) + return 0; + if (hs->dc_timer) { g_source_remove(hs->dc_timer); hs->dc_timer = 0; |