Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

perf(enc-avfoundation): prefer copy_with_new_timing over full sample buffer rebuild

Richie McIlroy08e7e51df47d
diff --git a/crates/enc-avfoundation/src/mp4.rs b/crates/enc-avfoundation/src/mp4.rs
index 99e6c7019..a2d747dfd 100644
--- a/crates/enc-avfoundation/src/mp4.rs
+++ b/crates/enc-avfoundation/src/mp4.rs
@@ -698,7 +698,11 @@ impl MP4Encoder {
dts: cm::Time::invalid(),
};
- let timed_frame = match rebuild_video_sample_buf(&pending.raw_frame, timing) {
+ let timed_frame = match pending
+ .raw_frame
+ .copy_with_new_timing(&[timing])
+ .or_else(|_| rebuild_video_sample_buf(&pending.raw_frame, timing))
+ {
Ok(f) => f,
Err(e) => {
warn!(