From 071ccd5a9702500f3f7d62ef881300914926184d Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 22 Dec 2011 16:08:41 -0800 Subject: audioflinger: fix clicks on 48kHz audio. The calculation done in prepareTracks_l() for the minimum amount off frames needed to mix one output buffer had 2 issues: - the additional sample needed for interpolation was not included - the fact that the resampler does not acknowledge the frames consumed immediately after each mixing round but only once all frames requested have been used was not taken into account. Thus the number of frames available in track buffer could be considered sufficient although it was not and the resampler would abort producing a short silence perceived as a click. Issue 5727099. Change-Id: I7419847a7474c7d9f9170bedd0a636132262142c --- services/audioflinger/AudioMixer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'services/audioflinger/AudioMixer.cpp') diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 6e9319d..1200f75 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -331,6 +331,23 @@ void AudioMixer::track_t::adjustVolumeRamp(bool aux) } } +size_t AudioMixer::track_t::getUnreleasedFrames() +{ + if (resampler != NULL) { + return resampler->getUnreleasedFrames(); + } + return 0; +} + +size_t AudioMixer::getUnreleasedFrames(int name) +{ + name -= TRACK0; + if (uint32_t(name) < MAX_NUM_TRACKS) { + track_t& track(mState.tracks[name]); + return track.getUnreleasedFrames(); + } + return 0; +} status_t AudioMixer::setBufferProvider(AudioBufferProvider* buffer) { -- cgit v1.1