modify abort tts hangle
This commit is contained in:
parent
a6153b1eb9
commit
dde41769bf
@ -69,6 +69,13 @@ class TTSAudioSplitHandle(TTSAudioHandle):
|
||||
logger.info('TTSAudioSplitHandle::on_handle is not running')
|
||||
return
|
||||
# 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:
|
||||
heapq.heappush(self._priority_queue, (index, None))
|
||||
else:
|
||||
@ -84,19 +91,15 @@ class TTSAudioSplitHandle(TTSAudioHandle):
|
||||
return
|
||||
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))
|
||||
if current == self._current:
|
||||
self._current = self._current + 1
|
||||
chunks = heapq.heappop(self._priority_queue)[1]
|
||||
if chunks is None:
|
||||
pass
|
||||
else:
|
||||
for chunk in chunks:
|
||||
self.on_next_handle(chunk, 0)
|
||||
print('TTSAudioSplitHandle::on_handle', index, current, self._current, len(self._priority_queue))
|
||||
if current == self._current:
|
||||
self._current = self._current + 1
|
||||
chunks = heapq.heappop(self._priority_queue)[1]
|
||||
if chunks is None:
|
||||
pass
|
||||
else:
|
||||
for chunk in chunks:
|
||||
self.on_next_handle(chunk, 0)
|
||||
|
||||
def stop(self):
|
||||
self._is_running = False
|
||||
|
Loading…
Reference in New Issue
Block a user