summaryrefslogtreecommitdiffstats
path: root/audio_a2dp_hw
diff options
context:
space:
mode:
authorNitin Srivastava <nitinsr@codeaurora.org>2014-12-22 19:54:09 +0530
committerAndre Eisenbach <eisenbach@google.com>2015-04-13 07:14:34 +0000
commit764babe943fc2e559923c7bf8514664187808ddd (patch)
tree0f2a7b27d276f36c8f895da5661e7cb6fb302ddf /audio_a2dp_hw
parent444a8da807abaf5f9e813ce70c56a79160495fb3 (diff)
downloadandroid_system_bt-764babe943fc2e559923c7bf8514664187808ddd.tar.gz
android_system_bt-764babe943fc2e559923c7bf8514664187808ddd.tar.bz2
android_system_bt-764babe943fc2e559923c7bf8514664187808ddd.zip
Protect reset of out stream with mutex
Protect reset of out stream with mutex so that the access of the same is properly synchronized in multi-threaded environment. Change-Id: I6dd81d8c7fa219ee8d1e4d82aa1e7ec52dcecec8
Diffstat (limited to 'audio_a2dp_hw')
-rw-r--r--audio_a2dp_hw/audio_a2dp_hw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c
index 5b194b412..a3ff331e7 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/audio_a2dp_hw/audio_a2dp_hw.c
@@ -1082,12 +1082,14 @@ static void adev_close_output_stream(struct audio_hw_device *dev,
INFO("closing output (state %d)", out->common.state);
+ pthread_mutex_lock(&out->common.lock);
if ((out->common.state == AUDIO_A2DP_STATE_STARTED) || (out->common.state == AUDIO_A2DP_STATE_STOPPING))
stop_audio_datapath(&out->common);
skt_disconnect(out->common.ctrl_fd);
free(stream);
a2dp_dev->output = NULL;
+ pthread_mutex_unlock(&out->common.lock);
DEBUG("done");
}