OSDN Git Service

android/hal-audio: Ignore write call when closing
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Mon, 10 Feb 2014 10:45:42 +0000 (11:45 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 10 Feb 2014 11:22:57 +0000 (13:22 +0200)
We should not try to neither auto-resume nor write when state is set to
NONE as this is case when we're being closed and it's ok do ignore
write request.

android/hal-audio.c

index efdf823..766327b 100644 (file)
@@ -831,6 +831,10 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
 {
        struct a2dp_stream_out *out = (struct a2dp_stream_out *) stream;
 
+       /* just return in case we're closing */
+       if (out->audio_state == AUDIO_A2DP_STATE_NONE)
+               return -1;
+
        /* We can auto-start only from standby */
        if (out->audio_state == AUDIO_A2DP_STATE_STANDBY) {
                DBG("stream in standby, auto-start");