fix: 调换 fps 与 setpts 顺序,修复 P0-3 xfade 多视频转场 PTS 不一致问题 #210

Merged
xiaoxia merged 1 commits from fix/p03-fps-setpts-order into develop 2026-07-10 18:16:01 +08:00

1 Commits

Author SHA1 Message Date
用户CI Test 29ed0592a0 fix: 调换 fps 与 setpts 顺序,修复 xfade 多视频转场 PTS 不一致问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 11s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m12s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
P0-3 根因:unified_render_service 中每个 clip 预处理滤镜链里,
fps 在 setpts=PTS-STARTPTS 之前执行。当多个视频有不同 timebase/
帧率时,fps 滤镜基于原始 PTS 进行帧转换,随后的 setpts 仅做
时间偏移,导致各片段 PTS 基准不一致,xfade 转场计算 offset 时
出错。

修复:将 setpts=PTS-STARTPTS 移到 fps 之前,先归一化 PTS 起
点,再统一帧率,确保所有片段在进入 xfade 前有一致的时间基准。

影响范围:
- 多视频 xfade 转场模式(主修复目标)
- 单视频一镜到底模式(同步修复,保持逻辑一致)

新增测试:
- test_setpts_before_fps_in_xfade_inputs: 多视频 xfade 模式验证
- test_setpts_before_fps_single_clip: 单视频模式验证
2026-07-10 17:43:54 +08:00