Commit 1044ea5d authored by David Tseng's avatar David Tseng Committed by Commit Bot

Always finalize tts buffers on stop

This was left out (somewhat intentionally) in an effort to optimize the
init/read path. However, this appears to be occasionally causing the process to
hit resource limits on linux causing no new threads in the process to be
created.

Sample error:
2020-10-21T00:37:18.448831Z ERROR chrome[19371:19371]: [tts_service.cc(29)] E1020 17:37:18.448238   19371 thread.cc:68] Thread create failed: Resource temporarily unavailable

R=dmazzoni@chromium.org

Fixed: 1140617
Test: continually read long text over and over again. Observe no crash.
Change-Id: Ie811b6ecc7e2bce9f898dc7cbd351cdfe5e4503d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489028
Auto-Submit: David Tseng <dtseng@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819265}
parent 0a30a6da
......@@ -205,8 +205,10 @@ void TtsService::StopLocked(bool clear_buffers) {
return;
output_device_->Pause();
if (clear_buffers)
if (clear_buffers) {
buffers_.clear();
libchrometts_.GoogleTtsFinalizeBuffered();
}
is_playing_ = false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment