summaryrefslogtreecommitdiffstats
path: root/audio_a2dp_hw
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2012-06-20 10:41:24 -0700
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:24 -0700
commit2f1980591e9a11c85929fb63aafd49313f05faca (patch)
tree7e72cb2da63c2ce91ce56557ec8c72201c4dcbe6 /audio_a2dp_hw
parent7c390f31a3b3a8b951da6344a8a32133952497c3 (diff)
downloadexternal_bluetooth_bluedroid-2f1980591e9a11c85929fb63aafd49313f05faca.zip
external_bluetooth_bluedroid-2f1980591e9a11c85929fb63aafd49313f05faca.tar.gz
external_bluetooth_bluedroid-2f1980591e9a11c85929fb63aafd49313f05faca.tar.bz2
Gaurd out_standby() API with mutex
Diffstat (limited to 'audio_a2dp_hw')
-rwxr-xr-xaudio_a2dp_hw/audio_a2dp_hw.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c
index c7abf8c..d65f3af 100755
--- a/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/audio_a2dp_hw/audio_a2dp_hw.c
@@ -89,7 +89,7 @@
#define FNLOG() ALOGV("%s", __FUNCTION__);
#define DEBUG(fmt, ...) ALOGD ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__)
-#define ASSERTC(cond, msg, val) if (!(cond)) {LOGE("### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
+#define ASSERTC(cond, msg, val) if (!(cond)) {ALOGE("### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
/*****************************************************************************
** Local type definitions
@@ -573,12 +573,19 @@ static int out_standby(struct audio_stream *stream)
{
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
+ int retVal = 0;
+
FNLOG();
+ pthread_mutex_lock(&out->lock);
+
if (out->state == AUDIO_A2DP_STATE_STARTED)
- return suspend_audio_datapath(out, true);
+ retVal = suspend_audio_datapath(out, true);
else
- return 0;
+ retVal = 0;
+ pthread_mutex_unlock (&out->lock);
+
+ return retVal;
}
static int out_dump(const struct audio_stream *stream, int fd)