[中] Mac 每次设置变化都重读 motion.json 并重算同步

Open
#58 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
swift
Domain
performance

Research direction

Read Sources/BirdLockCore/Render/RenderJob.swift around lines 90-113 first to see that init loads motion.json and recomputes composePlan/corrections on every construction, then Sources/BirdLockCore/Render/VideoStabilization.swift:393 for the ~201-offset synchronize scan. Next read the debounced rebuildJob in Sources/BirdLockApp/AppState.swift:509-527 and the export path at :1025 to confirm rebuildWork?.cancel() cannot stop work already started and that the export builds a RenderJob on the MainActor. Done means one in-flight build task with an early cancellation check inside the work item, a cache keyed on analysis.fingerprint plus stabilization settings, and detached export construction, verified by dragging sliders and watching CPU. Static audit only; nothing reproduced on device yet.

Written by the indexing model from the issue text.

Description

位置:Sources/BirdLockCore/Render/RenderJob.swift:90-113;Sources/BirdLockCore/Render/VideoStabilization.swift:393;Sources/BirdLockApp/AppState.swift:509-527、:1025

现象:RenderJob.init 每次都读取 motion.json、重算 composePlan/corrections(其中 synchronize 会扫描约 201 个偏移)并调用 VideoSource.arrange。rebuildJob 在每次设置变化时以 60 ms 防抖重建,但 rebuildWork?.cancel() 只取消尚未执行的 DispatchWorkItem,已开始的重活无法停止。AppState.export 还会在 MainActor 上同步构造 RenderJob。

复现:打开带陀螺仪的视频工程,快速拖动设置滑块,观察 CPU 与主线程卡顿。

建议:只保留一个在跑的构建任务并在 work 内先检查取消;按 analysis.fingerprint + 稳定化设置 缓存 motion 与同步结果;把导出用的构造移入 Task.detached。

来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在实机复现(静态审计)。

Dominant language
Swift
Stars
2
Forks
2
Avg merge
1h 11m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cyandee/BirdLock

All issues in cyandee/BirdLock

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.