mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 00:58:34 +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 MAX_CHUNK_SIZE = 1800;
|
||||||
const HIGH_WATER_BUFFER_SIZE = 1000;
|
const HIGH_WATER_BUFFER_SIZE = 1000;
|
||||||
const LOW_WATER_BUFFER_SIZE = 200;
|
const LOW_WATER_BUFFER_SIZE = 200;
|
||||||
const TIMEOUT_RETRY_MSECS = 3000;
|
const TIMEOUT_RETRY_MSECS = 1000; // 1 second
|
||||||
|
|
||||||
|
|
||||||
const isWhitespace = (str) => /^\s*$/.test(str);
|
const isWhitespace = (str) => /^\s*$/.test(str);
|
||||||
@@ -377,6 +377,7 @@ class TtsStreamingBuffer extends Emitter {
|
|||||||
|
|
||||||
_onTimeout() {
|
_onTimeout() {
|
||||||
this.logger.debug('TtsStreamingBuffer:_onTimeout Timeout waiting for sentence boundary');
|
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.
|
// Check if new text has been added since the timer was set.
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now - this.lastUpdateTime < TIMEOUT_RETRY_MSECS) {
|
if (now - this.lastUpdateTime < TIMEOUT_RETRY_MSECS) {
|
||||||
@@ -384,7 +385,6 @@ class TtsStreamingBuffer extends Emitter {
|
|||||||
this._setTimerIfNeeded();
|
this._setTimerIfNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.timer = null;
|
|
||||||
this._feedQueue(true);
|
this._feedQueue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user