History log of /frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
67ae6bc83cf2b30b0c61b9ebba5fed7a0038549c 30-Nov-2011 Narayan Kamath <narayan@google.com> Simplify the implementation of AudioPlaybackHandler.

Now uses a queue of runnables, one per synthesis. Also
introduce an abstraction that wraps AudioTrack that implements
the blocking semantics that we desire.

bug:5680699

Change-Id: I34a1248ff05766a7d9b3002055fb5b24aa9f230b
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
4f9787d6f4058a0f6df08456119edd2ae1b546cd 30-Nov-2011 Narayan Kamath <narayan@google.com> am 7dfb3e61: am cc084f1d: Fix superfluous onError callbacks.

* commit '7dfb3e611a9b4db4ffadcaa18a833de083647159':
Fix superfluous onError callbacks.
cc084f1d734c1e332d6acc1f89204036ee82bd0c 30-Nov-2011 Narayan Kamath <narayan@google.com> Fix superfluous onError callbacks.

When stop() is called twice or after done().This relates
to bug 5662598 because users using the old deprecated API
will see two calls to onUtteranceCompleted.

bug:5662598
Change-Id: I5d59cf66b4f4c8650d3f8f9e503ac3f33132c0d0
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
492b7f0d51f53164aa6eb974cd7ab6a7889af677 29-Nov-2011 Narayan Kamath <narayan@google.com> Allow multiple TextToSpeech instances per calling app.

We now use an IBinder object as an identity token of the
caller instead of Context#getPackageName.

bug:5680696
Change-Id: I1ca29e7161f709d2a85218206f3f117dfa620282
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
40f71f0be3cefabde9dc066d7707a1e5ebaec820 23-Nov-2011 Narayan Kamath <narayan@google.com> Fix regressions in TTS completion callbacks.

(a) onUtteranceCompleted should be called on errors too. Also,
fix up the error handling so that onUtteranceCompleted is
always called.
(b) Don't treat empty utterances as errors, and let the engine
synthesize them, as before.

bug:5662598
Change-Id: I9223592bc6fe5f47d71103f4f02f046b54a655a8
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
754c72ed9e8e83e5a913aa7552fc2e1b1b5277e0 09-Nov-2011 Narayan Kamath <narayan@google.com> Notifiy callers when a speech synthesis error occurs.

bug:5589877
Change-Id: Ideca8966ea1caa6789b3273e388dd1f25c1e2758
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
69bc1b2696dde849102f0ac8071999843d01b8d1 14-Sep-2011 Narayan Kamath <narayan@google.com> Don't wait indefinitely for audio tracks to finish playing.

If the track doesn't make progress for a fixed amount of time,
bail.

bug:5309562
Change-Id: I76966b8b3b2f05ba577892899791a09f50a70107
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
97171243f82532398a96f7f7adcceb61722519de 30-Aug-2011 Narayan Kamath <narayan@google.com> Change the heuristics for waiting for audiotracks to finish.

This is made necessary by a bug when the utterance is smaller
than the audio buffer size. In that case, we call stop() to
flush the audio to the mixer, but that causes the playstate to
be set to stopped though some audio is still being mixed. This
breaks our waiting loop.

We now wait a fixed amount of time for such short utterances
and do not observe the playback head position.

bug:5220048
Change-Id: Ic81dec751c1faca0b14164caeda6305c8f9815fe
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
2a0518cd1d18dc50ffa063a71133e69de2e866ab 26-Aug-2011 Narayan Kamath <narayan@google.com> Don't allow TTS engines to synthesize too for ahead.

For each synthesis request, we inspect the number of
bytes of audio that have not been written to the mixer yet
and if that is above a certain threshold (currently 500ms),
we block the synthesis thread.

bug:5214603
Change-Id: I24c64c48466bdb96ce47b34cee7da2523ee5f0eb
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
673f360b0e22a8591f515cba7a90d5cfcfad81a7 20-Jul-2011 Narayan Kamath <narayan@google.com> Fix some AudioTrack related issues.

(a) Call stop() when we've written less than the
AudioTrack buffer. This forces pending buffers to
get mixed.

(b) Introduce a minimum sleep time to avoid spinlocks
if they system is busy

Change-Id: If70937e8b4e8c5d02d7dadc0d3086f97a10eb7ef
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
a36cce06a63ff0eb1c3a765ceb3863195732b4bf 19-Jul-2011 Narayan Kamath <narayan@google.com> Fix a threading issue in AudioPlaybackHandler

Never allow the AudioTrack to be observed in a state where
it is release()d but non null.

Change-Id: I1e5b61355f30c2aafcd55ecdf83077d7a9d99c66
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
90e5650f96dabadaaf141beae20a646855073ae1 18-Jul-2011 Narayan Kamath <narayan@google.com> Few minor TTS clean ups.

(a) Remove unnecessary null check.
(b) Remove unused function.
(c) Clean up for TextToSpeech#shutdown.

Change-Id: I3ec5bccc327437064da130634a14aaf7d48eca4d
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
be4ad4ac66d6b4b878ed052975f7fb09af92c6d6 15-Jul-2011 Narayan Kamath <narayan@google.com> Fix a few threading issues in the AudioPlaybackHandler.

Also fixes a bug where PlaybackSynthesisCallback would
continue to pump audio to the audio playback thread after
being stopped.

Change-Id: I3233eb4858245b6e7c7df72e241a0708c668f1b4
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
c34f76fe89b5a31d01d63067c2f24b9a6a76df18 15-Jul-2011 Narayan Kamath <narayan@google.com> Improve TextToSpeech#isSpeaking()

Query the audio playback thread to check if it's busy.

bug:5033910
Change-Id: Ie57c7776bac27c2e712ddad4ec50fb7d78ea82e7
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
c3da8818f0598b3ab2cd6f4168349da6d0f72cb1 01-Jul-2011 Narayan Kamath <narayan@google.com> Remove the completeAudioAvailable API.

Measurements have shown that the audio track in streaming mode
is pretty efficient as is, thanks to dalvik's JNI implementation.

Also, in streaming mode write( ) blocks until all data has been
copied to the mixer, which is the kind of behaviour we want so
that we don't have to explicitly block in our code. Also,
the java AudioTrack is thread-safe with respect to stop( ) calls
during write, which means we can do everything completeAudioAvailable
did, just as efficiently without it.

Change-Id: I70a8a108d94c7260676673979b5ea29f37fa5db4
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
47d6288541324b27c80b9949670f7b6b18d3ae4c 13-Jul-2011 Narayan Kamath <narayan@google.com> Wait until the audio track finishes playing before releasing it.

Release calls stop, which causes truncation of playback.
bug:5021056

Change-Id: I8eadcbf5622dab83be3c4dabfcc06629398f27ab
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
6dabb63307a0b63f9386d61e8444aed29db2081e 08-Jul-2011 Narayan Kamath <narayan@google.com> Add event-log logging for TTS requests.

Change-Id: I5023194c469a602b85259088a2e59373c96a941e
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
963719869967cc257e666809aeb9bff3f25117ed 05-Jul-2011 Narayan Kamath <narayan@google.com> Minor changes to AudioTrack handling

Based on a discussion with the media folks.

Change-Id: I290cec062fcb53fccae1fd92387439448a54e81c
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
abc63fbddab2477a2954bc804aba2826e1f11084 10-Jun-2011 Narayan Kamath <narayan@google.com> Some TTS fixes.

(a) Document the undocumented queue mode (mode == 2)
(b) intern strings to fix a bug in removeCallbacksAndMessages
(c) remove an unnecessarly lock object, change the field it
guarded to volatile.

Change-Id: If46bbfe2afb047b3ba5b3cb9a90c292656379ec1
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
4924fe38675f0bf69bb0c16fc059ffa1606807ce 09-Jun-2011 Narayan Kamath <narayan@google.com> Implement QUEUE_FLUSH and QUEUE_DESTROY addition modes.

Note that this change is slightly more flexible, it defines
a priority for each playback request. We needn't really throw
away synthesis requests from other apps. We could just play
them after higher priority ones (for e.g from talkback).

Change-Id: I6c7dd9abe4871e87da08d9aaa4c55225a69078e5
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java
8d1fc2403b8277e68d7816b2bbf05464a4c7a58a 03-Jun-2011 Narayan Kamath <narayan@google.com> Fix the threading behaviour of TTS audio requests.

All audio is played back on a separate thread.

Change-Id: I2bbb7b3140f6a04ef705cadb2bd1ae88951e3c48
/frameworks/base/core/java/android/speech/tts/AudioPlaybackHandler.java