Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: stop avfoundation mp4 writes when paused (#1308)
Richie McIlroybbcc615b9267
diff --git a/crates/enc-avfoundation/src/mp4.rs b/crates/enc-avfoundation/src/mp4.rsindex d06648aa2..7c71156ea 100644--- a/crates/enc-avfoundation/src/mp4.rs+++ b/crates/enc-avfoundation/src/mp4.rs@@ -452,13 +452,25 @@ impl MP4Encoder {return Err(FinishError::NotWriting);}+ let mut finish_timestamp = timestamp;++ if let Some(pause_timestamp) = self.pause_timestamp {+ finish_timestamp = Some(match finish_timestamp {+ Some(ts) => ts.min(pause_timestamp),+ None => pause_timestamp,+ });+ }+let Some(mut most_recent_frame) = self.most_recent_frame.take() else {warn!("Encoder attempted to finish with no frame");return Err(FinishError::NoFrames);};+ self.is_paused = false;+ self.pause_timestamp = None;+// We extend the video to the provided timestamp if possible- if let Some(timestamp) = timestamp+ if let Some(timestamp) = finish_timestamp&& let Some(diff) = timestamp.checked_sub(most_recent_frame.1)&& diff > Duration::from_millis(500){