author | zhenggang.luo <zhenggang.luo@amlogic.com> | 2014-06-20 11:17:57 (GMT) |
---|---|---|
committer | tao.dong <tao.dong@amlogic.com> | 2014-07-02 04:15:08 (GMT) |
commit | fa84559cff630e13caf913eb52e908da2add8f4d (patch) | |
tree | 565f46a74fad3af261db30577f51737de87fc684 | |
parent | 11c4d3c25f6c7fe512c8c22e57c519cdcfbc441d (diff) | |
download | audio-fa84559cff630e13caf913eb52e908da2add8f4d.zip audio-fa84559cff630e13caf913eb52e908da2add8f4d.tar.gz audio-fa84559cff630e13caf913eb52e908da2add8f4d.tar.bz2 |
#91949-2:HDMI HAL return latency dynamically
-rwxr-xr-x | hdmi_audio_hw.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/hdmi_audio_hw.c b/hdmi_audio_hw.c index 7069066..13a2e5a 100755 --- a/hdmi_audio_hw.c +++ b/hdmi_audio_hw.c @@ -885,8 +885,12 @@ 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; - return (PERIOD_SIZE * PLAYBACK_PERIOD_COUNT * 1000) / out->config.rate; + struct aml_stream_out *out = (struct aml_stream_out *)stream; + + 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); } |