mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fixed tts streaming buffer cannot reset timeoutwhen lastUpdateTime is short (#1184)
* fixed tts streaming buffer cannot reset timeoutwhen lastUpdateTime is short * wip
This commit is contained in:
@@ -8,7 +8,7 @@ const {
|
||||
const MAX_CHUNK_SIZE = 1800;
|
||||
const HIGH_WATER_BUFFER_SIZE = 1000;
|
||||
const LOW_WATER_BUFFER_SIZE = 200;
|
||||
const TIMEOUT_RETRY_MSECS = 3000;
|
||||
const TIMEOUT_RETRY_MSECS = 1000; // 1 second
|
||||
|
||||
|
||||
const isWhitespace = (str) => /^\s*$/.test(str);
|
||||
@@ -377,6 +377,7 @@ class TtsStreamingBuffer extends Emitter {
|
||||
|
||||
_onTimeout() {
|
||||
this.logger.debug('TtsStreamingBuffer:_onTimeout Timeout waiting for sentence boundary');
|
||||
this.timer = null;
|
||||
// Check if new text has been added since the timer was set.
|
||||
const now = Date.now();
|
||||
if (now - this.lastUpdateTime < TIMEOUT_RETRY_MSECS) {
|
||||
@@ -384,7 +385,6 @@ class TtsStreamingBuffer extends Emitter {
|
||||
this._setTimerIfNeeded();
|
||||
return;
|
||||
}
|
||||
this.timer = null;
|
||||
this._feedQueue(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user