summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-03-27 12:05:40 -0700
committerEric Laurent <elaurent@google.com>2013-03-27 18:12:22 -0700
commit857583fd2ecbeb8696ede1f93b7291449fb2d133 (patch)
tree339da426a159d401daede0ac91d45584d7d56807 /include
parente31881eee441f409cbe6c1e1f32183ee8a64cdf8 (diff)
downloadframeworks_av-857583fd2ecbeb8696ede1f93b7291449fb2d133.zip
frameworks_av-857583fd2ecbeb8696ede1f93b7291449fb2d133.tar.gz
frameworks_av-857583fd2ecbeb8696ede1f93b7291449fb2d133.tar.bz2
ToneGenerator: fix truncated tones
The first DTMF tone after a silent period is truncated. This is because the phone app starts and stops the tone when the user presses and releases the key. This combined to the fact that the tones use the low latency path and that when the output stream exists standby there is a period of several milliseconds during which no audio is mixed until the stream is "warmed up". The result is that much less audio is generated than the actual key press duration. The fix consists in storing the tone start time and making sure that the number of samples generated corresponds at least to the time difference between the tone start and stop commands. Bug 6607077 Change-Id: I070d20dd8600c25a9e5d5a60c1d3313b7917b00d
Diffstat (limited to 'include')
-rw-r--r--include/media/ToneGenerator.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index 0529bcd..2183fbe 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -271,6 +271,7 @@ private:
float mVolume; // Volume applied to audio track
audio_stream_type_t mStreamType; // Audio stream used for output
unsigned int mProcessSize; // Size of audio blocks generated at a time by audioCallback() (in PCM frames).
+ struct timespec mStartTime; // tone start time: needed to guaranty actual tone duration
bool initAudioTrack();
static void audioCallback(int event, void* user, void *info);