Merge pull request #147 from choomegan/diar_queue
Ensure diarization_queue receives only latest PCM chunk
This commit is contained in:
commit
2ca1156b7e
1 changed files with 5 additions and 7 deletions
|
|
@ -193,12 +193,6 @@ class AudioProcessor:
|
||||||
|
|
||||||
self.pcm_buffer.extend(chunk)
|
self.pcm_buffer.extend(chunk)
|
||||||
|
|
||||||
# Send to diarization if enabled
|
|
||||||
if self.args.diarization and self.diarization_queue:
|
|
||||||
await self.diarization_queue.put(
|
|
||||||
self.convert_pcm_to_float(self.pcm_buffer).copy()
|
|
||||||
)
|
|
||||||
|
|
||||||
# Process when enough data
|
# Process when enough data
|
||||||
if len(self.pcm_buffer) >= self.bytes_per_sec:
|
if len(self.pcm_buffer) >= self.bytes_per_sec:
|
||||||
if len(self.pcm_buffer) > self.max_bytes_per_sec:
|
if len(self.pcm_buffer) > self.max_bytes_per_sec:
|
||||||
|
|
@ -215,6 +209,10 @@ class AudioProcessor:
|
||||||
if self.args.transcription and self.transcription_queue:
|
if self.args.transcription and self.transcription_queue:
|
||||||
await self.transcription_queue.put(pcm_array.copy())
|
await self.transcription_queue.put(pcm_array.copy())
|
||||||
|
|
||||||
|
# Send to diarization if enabled
|
||||||
|
if self.args.diarization and self.diarization_queue:
|
||||||
|
await self.diarization_queue.put(pcm_array.copy())
|
||||||
|
|
||||||
# Sleep if no processing is happening
|
# Sleep if no processing is happening
|
||||||
if not self.args.transcription and not self.args.diarization:
|
if not self.args.transcription and not self.args.diarization:
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue