[中] VideoExporter 的插帧闭包与主线程无锁共享状态

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
swift

Research direction

Start in Sources/BirdLockCore/Export/VideoExporter.swift, reading the interp closure at :179-196 alongside the main-thread reads and writes at :249 and :265; note that :163 forcing workers = 1 in AI mode does not remove the concurrency. Trace how OrderedPixelBuffers dispatches the closure and which queue drains it, then choose between a lock-protected state box and confining warning and aiBox to the render queue with a synchronized fetch at the end. Done means each field has one owner, export output is unchanged, and a Thread Sanitizer run over the export path is clean. The payload names no tests, so ask maintainers how they exercise the exporter before starting.

Written by the indexing model from the issue text.

Description

位置:Sources/BirdLockCore/Export/VideoExporter.swift:179-196、:249、:265

现象:interp 闭包在 OrderedPixelBuffers 的工作线程执行,内部读写 self.warning、重赋值捕获的 aiBox;主线程在 :249、:265 又读写 aiBox/warning,没有锁。即使 AI 模式 workers = 1(:163),主线程与工作线程仍并发访问,属于数据竞争。

建议:用锁保护的引用盒子保存 warning 与 aiBox,或把这些状态限制在渲染队列并在结束时同步取回。

来源: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.