summaryrefslogtreecommitdiff
authorjian.xu <jian.xu@amlogic.com>2014-07-07 05:20:57 (GMT)
committer Sandy lUo <sandy.luo@amlogic.com>2014-07-07 05:43:38 (GMT)
commit4bd0110c36824cdc60c0646609d63fd5aa430f77 (patch)
treedecc641fd06370ab2645c09b3e250fcb120bc1bb
parent07f2ea917993411bd83dcdd1df1a43724cd975d5 (diff)
downloadaudio-4bd0110c36824cdc60c0646609d63fd5aa430f77.zip
audio-4bd0110c36824cdc60c0646609d63fd5aa430f77.tar.gz
audio-4bd0110c36824cdc60c0646609d63fd5aa430f77.tar.bz2
PD #93081, [HDMI HAL]randomly zizi noise when touch sound. tinyalsa return -1 when get delay from kernel, this cause Static Sound Track access illegal address.
Diffstat
-rwxr-xr-xhdmi_audio_hw.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hdmi_audio_hw.c b/hdmi_audio_hw.c
index f0dd32a..89ac1a4 100755
--- a/hdmi_audio_hw.c
+++ b/hdmi_audio_hw.c
@@ -891,12 +891,17 @@ static char * out_get_parameters(const struct audio_stream *stream, const char *
static uint32_t out_get_latency(const struct audio_stream_out *stream)
{
- struct aml_stream_out *out = (struct aml_stream_out *)stream;
-
+ struct aml_stream_out *out = (struct aml_stream_out *)stream;
+ uint32_t whole_latency;
+ uint32_t ret;
+ whole_latency = (out->config.period_size * out->config.period_count * 1000) / out->config.rate;
if (!out->pcm || !pcm_is_ready(out->pcm))
- return (out->config.period_size * out->config.period_count * 1000) / out->config.rate;
-
- return pcm_get_latency(out->pcm);
+ return whole_latency;
+ ret = pcm_get_latency(out->pcm);
+ if(ret == -1){
+ return whole_latency;
+ }
+ return ret;
}