From d7d3f3184b626e198cd4bfd52ce38201731868ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E5=BA=94?= Date: Mon, 28 Sep 2026 15:31:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20GPU=20=E7=9B=B4?= =?UTF-8?q?=E8=BF=9E=E7=AE=A1=E7=BA=BF=E4=B8=AD=20l.role=20=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=90=8D=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _can_use_gpu_direct 和 _try_gpu_direct 方法中 3 处列表推导式 误用未定义变量 l 代替循环变量 _lyr,导致 NameError 使 gpu-direct eligibility check 始终失败并 fallback 到 CPU 路径。 修复: l.role -> _lyr.role (line 2220, 2275, 2280) --- apps/worker/video_processing/unified_render_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/worker/video_processing/unified_render_service.py b/apps/worker/video_processing/unified_render_service.py index 35c816fe2..c5d4efb16 100755 --- a/apps/worker/video_processing/unified_render_service.py +++ b/apps/worker/video_processing/unified_render_service.py @@ -2217,7 +2217,7 @@ class UnifiedRenderService: if not bool(cfg.get("gpu_direct_enabled", True)): return False - video_layers = [_lyr for _lyr in layers if l.role not in ("audio",)] + video_layers = [_lyr for _lyr in layers if _lyr.role not in ("audio",)] # 只允许一个视频层,且角色为主层 if len(video_layers) != 1: return False @@ -2272,12 +2272,12 @@ class UnifiedRenderService: from video_processing import gpu_direct_pipeline as gdp cfg = self.plan.config or {} - video_layer = next(_lyr for _lyr in layers if l.role not in ("audio",)) + video_layer = next(_lyr for _lyr in layers if _lyr.role not in ("audio",)) video_clips = [c for c in video_layer.clips if c.clip_type != "audio"] # TTS:把 audio 层的 TTS 片段合并成一个文件给 P4000 tts_merged: Path | None = None - audio_layer = next((_lyr for _lyr in layers if l.role == "audio"), None) + audio_layer = next((_lyr for _lyr in layers if _lyr.role == "audio"), None) if audio_layer: tts_clips = [c for c in audio_layer.clips if (c.config or {}).get("tts") and c.local_path.exists()] if tts_clips: