mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix say verb does not close streaming when finish say (#1412)
* fix say verb does not close streaming when finish say * wip * wip * ttsStreamingBuffer reset eventHandlerCount after remove listeners * only send tokens to module if connected * wip * sent stream_open when successfully connected to vendor
This commit is contained in:
@@ -335,7 +335,8 @@
|
||||
"Empty": "tts_streaming::empty",
|
||||
"Pause": "tts_streaming::pause",
|
||||
"Resume": "tts_streaming::resume",
|
||||
"ConnectFailure": "tts_streaming::connect_failed"
|
||||
"ConnectFailure": "tts_streaming::connect_failed",
|
||||
"Connected": "tts_streaming::connected"
|
||||
},
|
||||
"TtsStreamingConnectionStatus": {
|
||||
"NotConnected": "not_connected",
|
||||
|
||||
@@ -80,7 +80,7 @@ class TtsStreamingBuffer extends Emitter {
|
||||
clearTimeout(this.timer);
|
||||
this.removeCustomEventListeners();
|
||||
if (this.ep) {
|
||||
this._api(this.ep, [this.ep.uuid, 'close'])
|
||||
this._api(this.ep, [this.ep.uuid, 'stop'])
|
||||
.catch((err) =>
|
||||
this.logger.info({ err }, 'TtsStreamingBuffer:stop Error closing TTS streaming')
|
||||
);
|
||||
@@ -193,10 +193,7 @@ class TtsStreamingBuffer extends Emitter {
|
||||
this.logger.debug('TtsStreamingBuffer:_feedQueue TTS stream is not open or no endpoint available');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
this._connectionStatus === TtsStreamingConnectionStatus.NotConnected ||
|
||||
this._connectionStatus === TtsStreamingConnectionStatus.Failed
|
||||
) {
|
||||
if (this._connectionStatus !== TtsStreamingConnectionStatus.Connected) {
|
||||
this.logger.debug('TtsStreamingBuffer:_feedQueue TTS stream is not connected');
|
||||
return;
|
||||
}
|
||||
@@ -365,6 +362,7 @@ class TtsStreamingBuffer extends Emitter {
|
||||
if (this.queue.length > 0) {
|
||||
await this._feedQueue();
|
||||
}
|
||||
this.emit(TtsStreamingEvents.Connected, { vendor });
|
||||
}
|
||||
|
||||
_onConnectFailure(vendor) {
|
||||
@@ -415,6 +413,7 @@ class TtsStreamingBuffer extends Emitter {
|
||||
|
||||
removeCustomEventListeners() {
|
||||
this.eventHandlers.forEach((h) => h.ep.removeCustomEventListener(h.event, h.handler));
|
||||
this.eventHandlers.length = 0;
|
||||
}
|
||||
|
||||
_initHandlers(ep) {
|
||||
|
||||
Reference in New Issue
Block a user