modify abort tts hangle

This commit is contained in:
brige 2024-11-10 14:06:47 +08:00
parent a6153b1eb9
commit dde41769bf

View File

@ -69,6 +69,13 @@ class TTSAudioSplitHandle(TTSAudioHandle):
logger.info('TTSAudioSplitHandle::on_handle is not running') logger.info('TTSAudioSplitHandle::on_handle is not running')
return return
# heapq.heappush(self._priority_queue, (index, stream)) # heapq.heappush(self._priority_queue, (index, stream))
with self._lock:
current = self._priority_queue[0][0]
if current == 0:
self._current = 0
self._priority_queue.clear()
if stream is None: if stream is None:
heapq.heappush(self._priority_queue, (index, None)) heapq.heappush(self._priority_queue, (index, None))
else: else:
@ -84,10 +91,6 @@ class TTSAudioSplitHandle(TTSAudioHandle):
return return
heapq.heappush(self._priority_queue, (index, chunks)) heapq.heappush(self._priority_queue, (index, chunks))
with self._lock:
current = self._priority_queue[0][0]
if current == 0:
self._current = 0
print('TTSAudioSplitHandle::on_handle', index, current, self._current, len(self._priority_queue)) print('TTSAudioSplitHandle::on_handle', index, current, self._current, len(self._priority_queue))
if current == self._current: if current == self._current:
self._current = self._current + 1 self._current = self._current + 1