diff options
| author | Eric Laurent <elaurent@google.com> | 2013-09-05 16:10:57 -0700 |
|---|---|---|
| committer | Eric Laurent <elaurent@google.com> | 2013-09-05 18:21:19 -0700 |
| commit | 6e89524079e9c3a1037c57a99854820d88c9380b (patch) | |
| tree | b31d65c997db2f5bb16c6b8e7d1b138b7b99f7f5 /hal | |
| parent | 4e02e5575f2eb440632a60fb8bed0a44ddae83af (diff) | |
| download | android_hardware_qcom_audio-6e89524079e9c3a1037c57a99854820d88c9380b.tar.gz android_hardware_qcom_audio-6e89524079e9c3a1037c57a99854820d88c9380b.tar.bz2 android_hardware_qcom_audio-6e89524079e9c3a1037c57a99854820d88c9380b.zip | |
hal: force stop after drain.
Force playback state to IDLE and send compress_stop()
when drain completes to force reset driver and DSP pointers.
This ensures that even if last write was partial, next write
will be on a 32 byte boundary.
Also do not wait for write completion if compress_write()
returns an error.
Bug 8174410.
Change-Id: If144981c6396b24515d45b32a75ab61872a35ea2
Diffstat (limited to 'hal')
| -rw-r--r-- | hal/audio_hw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 73d9a3b0..852ddf68 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -740,8 +740,11 @@ static void *offload_thread_loop(void *context) pthread_mutex_lock(&out->lock); out->offload_thread_blocked = false; pthread_cond_signal(&out->cond); - if (send_callback) + if (send_callback) { + if (event == STREAM_CBK_EVENT_DRAIN_READY) + stop_compressed_output_l(out); out->offload_callback(event, NULL, out->offload_cookie); + } free(cmd); } @@ -1268,7 +1271,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, { struct stream_out *out = (struct stream_out *)stream; struct audio_device *adev = out->dev; - size_t ret = 0; + ssize_t ret = 0; pthread_mutex_lock(&out->lock); if (out->standby) { @@ -1285,7 +1288,8 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { ret = compress_write(out->compr, buffer, bytes); - if (ret < bytes) { + ALOGVV("%s: writing buffer (%d bytes) to pcm device returned %d", __func__, bytes, ret); + if (ret >= 0 && ret < (ssize_t)bytes) { send_offload_cmd_l(out, OFFLOAD_CMD_WAIT_FOR_BUFFER); } if (!out->playback_started) { |
