Fix issue 2139634: DTMF tones on Sholes popping, hissing (audio latency too high).
This change is a complement to the main fix in kernel driver for the same issue (partner change #1250).
It removes clicks sometimes heard after the end of the tones while audio flinger is sending 0s to the audio output stream.
The problem was that the sleep time between two writes was more than the duration of one audio output stream buffer which could cause some underrun.
Also fixed a recent regression in ToneGenerator that made that the end of previous tone was repeated at the beginning of current one under certain timing circumstances when the maximum tone duration was specified.
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 3699019..4bf73ce 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -524,6 +524,10 @@
bool mMasterMute;
SortedVector< wp<Track> > mActiveTracks;
+ virtual int getTrackName_l() = 0;
+ virtual void deleteTrackName_l(int name) = 0;
+ virtual uint32_t getMaxBufferRecoveryInUsecs() = 0;
+
private:
friend class AudioFlinger;
@@ -539,8 +543,7 @@
status_t addTrack_l(const sp<Track>& track);
void destroyTrack_l(const sp<Track>& track);
- virtual int getTrackName_l() = 0;
- virtual void deleteTrackName_l(int name) = 0;
+
void readOutputParameters();
virtual status_t dumpInternals(int fd, const Vector<String16>& args);
@@ -571,13 +574,14 @@
int streamType);
void putTracks(SortedVector < sp<Track> >& tracks,
SortedVector < wp<Track> >& activeTracks);
- virtual int getTrackName_l();
- virtual void deleteTrackName_l(int name);
virtual bool checkForNewParameters_l();
virtual status_t dumpInternals(int fd, const Vector<String16>& args);
protected:
size_t prepareTracks_l(const SortedVector< wp<Track> >& activeTracks, Vector< sp<Track> > *tracksToRemove);
+ virtual int getTrackName_l();
+ virtual void deleteTrackName_l(int name);
+ virtual uint32_t getMaxBufferRecoveryInUsecs();
AudioMixer* mAudioMixer;
};
@@ -591,9 +595,12 @@
// Thread virtuals
virtual bool threadLoop();
+ virtual bool checkForNewParameters_l();
+
+ protected:
virtual int getTrackName_l();
virtual void deleteTrackName_l(int name);
- virtual bool checkForNewParameters_l();
+ virtual uint32_t getMaxBufferRecoveryInUsecs();
private:
float mLeftVolume;