from app.utils.logger import get_logger import time stream_manager = {} logger = get_logger(__name__) def stop_stream(stream_id: str): if stream_id in stream_manager: process = stream_manager[stream_id]["process"] process.terminate() process.wait() # 确保进程已经完全终止 logger.info(f"Stream {stream_id} stopped.") del stream_manager[stream_id]