refactor: unify frame sharing with Rust Arc, remove FFmpeg ref counting #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace FFmpeg's internal reference counting (av_frame_clone) with Rust's Arc<RwLock> for sharing frame data. This eliminates dual reference counting and provides a single source of truth.
Key changes:
🤖 Generated with Claude Code
Note
Unifies frame ownership by replacing FFmpeg ref-counted clones with Rust
Arc<RwLock<Frame>>, reducing copies and centralizing synchronization.parking_lotand introduceFrame::deep_clone()andFrame::into_shared(); removetry_clone()usage throughoutAudioData/VideoFrameinternals toArc<RwLock<Frame>>;VideoFrame.clone()now shares backing data; exposeframe_arc()and addfrom_internal_arc(_with_color_space)VideoEncoder/AudioEncoderto accept/share frames viaArcand onlydeep_clone()when mutation or upload requires ownership; adjust scaling/copy paths to use read locksImageDecodercaches decoded frames as sharedArcframes and returnsVideoFramevia shared constructorsPacket::try_clone()andCloneimpl (no callers)VideoFrame.clone()sharing semantics inindex.d.tsWritten by Cursor Bugbot for commit 720f0c4. This will update automatically on new commits. Configure here.