diff options
author | Eric Laurent <elaurent@google.com> | 2012-03-30 09:43:23 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-04-02 15:37:29 -0700 |
commit | 22ab522f99b48bf3c3d5850c72bc270a021258e7 (patch) | |
tree | 116615ef2f3d99b05bb365b5cf0b82da717750de /audio | |
parent | 20ed9859b36a49f3633faec876bf1635a8e7b669 (diff) | |
download | device_samsung_tuna-22ab522f99b48bf3c3d5850c72bc270a021258e7.zip device_samsung_tuna-22ab522f99b48bf3c3d5850c72bc270a021258e7.tar.gz device_samsung_tuna-22ab522f99b48bf3c3d5850c72bc270a021258e7.tar.bz2 |
audio: fix error in capture path delay calculation
Fix error in get_capture_delay() that was not taking into account
the fact that frames in in->buffer are at driver sampling rate while
frames in in->proc_buf are at requested sampling rate.
Change-Id: I09e627bd316daedab5ffea3dd638254eaa270a5b
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_hw.c | 7 |
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) { |