summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhanalakshmi Siddani <dsiddani@codeaurora.org>2015-01-13 22:36:55 +0530
committerSteve Kondik <steve@cyngn.com>2015-02-01 16:30:13 -0800
commit6a985886e693dec21310537e527b1df46a9a5f9c (patch)
treeb0b67278ebbfd7b81919d72168c999830a715636
parent98d5bb06cea9c3dd02c5e6c20fd3e3fc42cb827f (diff)
downloadandroid_hardware_qcom_audio-6a985886e693dec21310537e527b1df46a9a5f9c.tar.gz
android_hardware_qcom_audio-6a985886e693dec21310537e527b1df46a9a5f9c.tar.bz2
android_hardware_qcom_audio-6a985886e693dec21310537e527b1df46a9a5f9c.zip
audio: Support for compress offload recovery
- Add support to return error for compress time stamp query during SSR CRs-Fixed: 683288 Change-Id: Ie6849bbd3de9474fa556bfe4b183a10a44e4b3e8
-rw-r--r--hal/audio_hw.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 6299ce27..e89f889e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2049,6 +2049,7 @@ static int out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
struct stream_out *out = (struct stream_out *)stream;
+ struct audio_device *adev = out->dev;
if (is_offload_usecase(out->usecase) && (dsp_frames != NULL)) {
ssize_t ret = 0;
*dsp_frames = 0;
@@ -2069,6 +2070,13 @@ static int out_get_render_position(const struct audio_stream_out *stream,
} else if(ret < 0) {
ALOGE(" ERROR: Unable to get time stamp from compress driver");
return -EINVAL;
+ } else if (get_snd_card_state(adev) == SND_CARD_STATE_OFFLINE){
+ /*
+ * Handle corner case where compress session is closed during SSR
+ * and timestamp is queried
+ */
+ ALOGE(" ERROR: sound card not active, return error");
+ return -EINVAL;
} else {
return 0;
}
@@ -2105,12 +2113,20 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
if (is_offload_usecase(out->usecase)) {
if (out->compr != NULL) {
- compress_get_tstamp(out->compr, &dsp_frames,
+ ret = compress_get_tstamp(out->compr, &dsp_frames,
&out->sample_rate);
ALOGVV("%s rendered frames %ld sample_rate %d",
__func__, dsp_frames, out->sample_rate);
*frames = dsp_frames;
- ret = 0;
+ if (ret < 0)
+ ret = -errno;
+ if (-ENETRESET == ret) {
+ ALOGE(" ERROR: sound card not active Unable to get time stamp from compress driver");
+ set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
+ ret = -EINVAL;
+ } else
+ ret = 0;
+
/* this is the best we can do */
clock_gettime(CLOCK_MONOTONIC, timestamp);
}