From d13ee7991b3a3004440369c2979094d0960f26f3 Mon Sep 17 00:00:00 2001 From: saas-backend-agent Date: Sun, 27 Sep 2026 14:31:14 +0800 Subject: [PATCH] test(tests/unit/test_ffmpeg_encoding_optimization.py): adapt to veryfast preset + gpu mezzanine relay refactor --- .../unit/test_ffmpeg_encoding_optimization.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/unit/test_ffmpeg_encoding_optimization.py b/tests/unit/test_ffmpeg_encoding_optimization.py index 027f88364..614413543 100644 --- a/tests/unit/test_ffmpeg_encoding_optimization.py +++ b/tests/unit/test_ffmpeg_encoding_optimization.py @@ -4,7 +4,7 @@ 1. 集中编码常量正确定义,支持环境变量覆盖 2. 所有渲染路径(_execute_ffmpeg / _render_pass_through / normalize_video / processor) 使用统一的编码参数 -3. preset 从 medium → fast,确保渲染速度提升 +3. preset 从 medium → veryfast(#2063 优化 fast→veryfast,再提速 38%) 4. threads=0 自动检测 CPU 核心数 """ @@ -27,7 +27,7 @@ class TestEncodingConstants: """默认 preset 应为 fast(非 medium),确保速度提升.""" from shared.ffmpeg_utils import FFMPEG_ENCODE_PRESET - assert FFMPEG_ENCODE_PRESET == "fast" + assert FFMPEG_ENCODE_PRESET == "veryfast" def test_default_crf_is_23(self): """默认 CRF 保持 23,画质不变.""" @@ -96,7 +96,7 @@ class TestWorkerReExport: """worker ffmpeg_utils 应 re-export FFMPEG_ENCODE_PRESET.""" from video_processing.ffmpeg_utils import FFMPEG_ENCODE_PRESET - assert FFMPEG_ENCODE_PRESET == "fast" + assert FFMPEG_ENCODE_PRESET == "veryfast" def test_worker_reexports_crf(self): """worker ffmpeg_utils 应 re-export FFMPEG_ENCODE_CRF.""" @@ -142,11 +142,11 @@ class TestExecuteFfmpegEncoding: return captured_cmd - def test_execute_uses_fast_preset(self): - """_execute_ffmpeg 应使用 fast preset.""" + def test_execute_uses_veryfast_preset(self): + """_execute_ffmpeg 应使用 veryfast preset.""" cmd = self._get_execute_command() idx = cmd.index("-preset") - assert cmd[idx + 1] == "fast" + assert cmd[idx + 1] == "veryfast" def test_execute_uses_crf_23(self): """_execute_ffmpeg 应使用 CRF 23.""" @@ -172,8 +172,8 @@ class TestExecuteFfmpegEncoding: class TestRenderPassThroughEncoding: """测试 _render_pass_through 方法使用正确的编码参数.""" - def test_passthrough_command_contains_fast_preset(self): - """_render_pass_through 命令应包含 fast preset.""" + def test_passthrough_command_contains_veryfast_preset(self): + """_render_pass_through 命令应包含 veryfast preset.""" # 通过源码检查确认参数已替换 import inspect @@ -200,8 +200,8 @@ class TestRenderPassThroughEncoding: class TestNormalizeVideoEncoding: """测试 normalize_video 使用正确的编码参数.""" - def test_normalize_uses_fast_preset(self): - """normalize_video 应使用 fast preset.""" + def test_normalize_uses_veryfast_preset(self): + """normalize_video 应使用 veryfast preset.""" import inspect from video_processing.ffmpeg_utils import normalize_video