diff options
author | Mattias Agren <magren@broadcom.com> | 2012-06-18 15:46:47 +0200 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-25 01:05:04 -0700 |
commit | 2112c8cf87f7feff19474f84d1b47b3fc3691c20 (patch) | |
tree | f603cd6eef16e9ca83190ac29f24841b6b8c4199 /audio_a2dp_hw | |
parent | 380218c08339039ea1130e7ec17d63f6182a91a7 (diff) | |
download | external_bluetooth_bluedroid-2112c8cf87f7feff19474f84d1b47b3fc3691c20.zip external_bluetooth_bluedroid-2112c8cf87f7feff19474f84d1b47b3fc3691c20.tar.gz external_bluetooth_bluedroid-2112c8cf87f7feff19474f84d1b47b3fc3691c20.tar.bz2 |
configure avdtp signalling timeout to default value (4 secs)
also added mutex protection for any a2dp control path signalling to
ensure only one outstanding request at a time
Change-Id: I06d95793a8632f6a8baec967a1d8440ecce8a65d
Conflicts:
audio_a2dp_hw/audio_a2dp_hw.c
Diffstat (limited to 'audio_a2dp_hw')
-rw-r--r--[-rwxr-xr-x] | audio_a2dp_hw/audio_a2dp_hw.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c index d65f3af..6bfec3c 100755..100644 --- a/audio_a2dp_hw/audio_a2dp_hw.c +++ b/audio_a2dp_hw/audio_a2dp_hw.c @@ -436,6 +436,7 @@ static int suspend_audio_datapath(struct a2dp_stream_out *out, bool standby) /* disconnect audio path */ skt_disconnect(out->audio_fd); + out->audio_fd = AUDIO_SKT_DISCONNECTED; return 0; @@ -478,6 +479,8 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, if ((out->state == AUDIO_A2DP_STATE_STOPPED) || (out->state == AUDIO_A2DP_STATE_STANDBY)) { + pthread_mutex_lock(&out->lock); + if (start_audio_datapath(out) < 0) { /* emulate time this write represents to avoid very fast write @@ -488,8 +491,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, DEBUG("emulate a2dp write delay (%d us)", us_delay); usleep(us_delay); + pthread_mutex_unlock(&out->lock); return -1; } + + pthread_mutex_unlock(&out->lock); } else if (out->state != AUDIO_A2DP_STATE_STARTED) { @@ -572,6 +578,7 @@ static int out_set_format(struct audio_stream *stream, audio_format_t format) static int out_standby(struct audio_stream *stream) { struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream; + int retval = 0; int retVal = 0; @@ -915,9 +922,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) DEBUG("state %d", out->state); - pthread_mutex_lock(&out->lock); retval = out->stream.common.set_parameters((struct audio_stream *)out, kvpairs); - pthread_mutex_unlock(&out->lock); return retval; } @@ -1124,3 +1129,4 @@ struct audio_module HAL_MODULE_INFO_SYM = { .methods = &hal_module_methods, }, }; + |