MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / stop

Method stop

lightx2v/utils/va_reader.py:217–236  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

215 return audio_data, self.segment_duration
216
217 def stop(self):
218 # Stop ffmpeg process
219 if self.ffmpeg_process:
220 self.ffmpeg_process.send_signal(signal.SIGINT)
221 try:
222 self.ffmpeg_process.wait(timeout=5)
223 except subprocess.TimeoutExpired:
224 self.ffmpeg_process.kill()
225 logger.warning("FFmpeg reader process stopped")
226
227 # Wait for threads to finish
228 if self.audio_thread and self.audio_thread.is_alive():
229 self.audio_thread.join(timeout=5)
230 if self.audio_thread.is_alive():
231 logger.error("Audio pull thread did not stop gracefully")
232
233 while self.audio_queue and self.audio_queue.qsize() > 0:
234 self.audio_queue.get_nowait()
235 self.audio_queue = None
236 logger.warning("Audio pull queue cleaned")
237
238 def __del__(self):
239 self.stop()

Callers 3

__del__Method · 0.95
va_reader.pyFile · 0.45
clearMethod · 0.45

Calls 3

waitMethod · 0.80
warningMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected