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
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 75c9170..0137185 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -91,6 +91,8 @@
static void ditherAndClamp(int32_t* out, int32_t const *sums, size_t c);
+ size_t getUnreleasedFrames(int name);
+
private:
enum {
@@ -167,6 +169,7 @@
bool doesResample() const;
void resetResampler();
void adjustVolumeRamp(bool aux);
+ size_t getUnreleasedFrames();
};
// pad to 32-bytes to fill cache line