From 11db147d66fb1339054414318d13f090d6905e77 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 5 Mar 2012 17:04:20 -0800 Subject: audio: fix wrong latency reported by audio HAL Commit 355afe9a broke the calculation of the latency returned by A2DP, leading to incorrect A/V sync. The latency must take into account the intermediate buffering added in audio HAL. Change-Id: I1f3d7494fe58517151c5dba0a4883f583d7a6ef2 --- audio/android_audio_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/android_audio_hw.c b/audio/android_audio_hw.c index e552f7a7..348ad14d 100644 --- a/audio/android_audio_hw.c +++ b/audio/android_audio_hw.c @@ -180,7 +180,7 @@ static uint32_t out_get_latency(const struct audio_stream_out *stream) { const struct astream_out *out = (const struct astream_out *)stream; - return (out->buffer_duration_us / 1000) + 200; + return ((out->buffer_duration_us * BUF_NUM_PERIODS) / 1000) + 200; } static int out_set_volume(struct audio_stream_out *stream, float left, -- cgit v1.2.3