Pre-fetch the first audio buffer within TtsService
On lower-end devices, given a very long, complex utterance, the first call to GoogleTtsReadBuffered can take time enough to underflow the SyncReader and cause an udnerrun. This manifests itself by the first few chunks of the tts playback being dropped entirely. No stuttering occurs though as playback is smooth the rest of the way. Therefore, a reasonable fix that works on-device is to pre-fetch the first buffer prior to starting audio playback for the utterance. Within the critical path (TtsService::Render), we can simply use the cached buffer and only call into read buffered for subsequent chunks, which is fast. R=dmazzoni@chromium.org Change-Id: I6bb049d3e8b487af11ca7f34d7ef7b7f82627792 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464067 Commit-Queue: David Tseng <dtseng@chromium.org> Reviewed-by:Dominic Mazzoni <dmazzoni@chromium.org> Cr-Commit-Position: refs/heads/master@{#815828}
Showing
Please register or sign in to comment