summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-04-02 15:47:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-02 15:47:25 -0700
commit5bb1263197e6900fb2be67df5a0dced4c6e7d0d1 (patch)
tree97e89dd9509ab918b6b89b1256d925f8431800d8
parentb044a57a3678afdbfb999cc5e61fe2c8997b995d (diff)
parent9897c2920b90e834f80ea549a0214d227ecb0266 (diff)
downloaddevice_samsung_tuna-5bb1263197e6900fb2be67df5a0dced4c6e7d0d1.zip
device_samsung_tuna-5bb1263197e6900fb2be67df5a0dced4c6e7d0d1.tar.gz
device_samsung_tuna-5bb1263197e6900fb2be67df5a0dced4c6e7d0d1.tar.bz2
Merge "audio: fix error in capture path delay calculation"
-rw-r--r--audio/audio_hw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index fe3dce3..b4138a6 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1828,8 +1828,11 @@ static void get_capture_delay(struct tuna_stream_in *in,
/* read frames available in audio HAL input buffer
* add number of frames being read as we want the capture time of first sample
* in current buffer */
- buf_delay = (long)(((int64_t)(in->frames_in + in->proc_frames_in) * 1000000000)
- / in->config.rate);
+ /* frames in in->buffer are at driver sampling rate while frames in in->proc_buf are
+ * at requested sampling rate */
+ buf_delay = (long)(((int64_t)(in->frames_in) * 1000000000) / in->config.rate +
+ ((int64_t)(in->proc_frames_in) * 1000000000) / in->requested_rate);
+
/* add delay introduced by resampler */
rsmp_delay = 0;
if (in->resampler) {