def close(self, timeout=5):
"""Stop a ffmpeg instance."""
if not self.is_running:
_LOGGER.warning("FFmpeg isn't running!")
return
try:
# send stop to ffmpeg
with async_timeout.timeout(timeout, loop=self._loop):
yield from self._proc.communicate(input=b'q')
_LOGGER.debug("Close FFmpeg process")
except (asyncio.TimeoutError, ValueError):
_LOGGER.warning("Timeout while waiting of FFmpeg")
self._proc.kill()
finally:
self._clear()
评论列表
文章目录