Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(preview): hold the last clip's own last frame, not the first one its cut removed
EtienneLescot910da204c0c6
diff --git a/crates/compositor/src/live.rs b/crates/compositor/src/live.rsindex 6ca4c538f..16c75bd9e 100644--- a/crates/compositor/src/live.rs+++ b/crates/compositor/src/live.rs@@ -491,15 +491,22 @@ impl Player {}/// La lecture libre est-elle au bout de la source écran ? Oui quand la frame courante,- /// composée, atteint `end_sec` (la fin de la fenêtre du clip) ou qu'aucune autre ne la suit- /// dans le fichier : `step` y reboucle au début.- unsafe fn reached_end(&mut self, end_sec: f64) -> Result<bool> {+ /// composée, atteint `end_sec` (la fin de la fenêtre du clip), quand la suivante, due d'ici+ /// `target_source_time`, tomberait hors de la fenêtre (`step` composerait une frame coupée),+ /// ou qu'aucune autre ne la suit dans le fichier : `step` y reboucle au début.+ unsafe fn reached_end(&mut self, end_sec: f64, target_source_time: f64) -> Result<bool> {// Une frame repositionnée (seek, bascule de clip) attend encore d'être composée.if self.use_current_on_next_step {return Ok(false);}- Ok(self.sdec.cur_time_sec() >= end_sec- || matches!(self.sdec.peek_next_time_sec()?, NextFrameTime::Eof))+ if self.sdec.cur_time_sec() >= end_sec {+ return Ok(true);+ }+ Ok(match self.sdec.peek_next_time_sec()? {+ NextFrameTime::At(t) => t >= end_sec && t <= target_source_time,+ NextFrameTime::Eof => true,+ NextFrameTime::Unknown => false,+ })}/// Compose la PROCHAINE frame due (→ `comp.rt`), au plus une, si `target_source_time`@@ -1842,7 +1849,7 @@ unsafe fn render_thread(// Fin du programme : la vue s'y arrête comme la tête de lecture de l'app,// au lieu de reboucler sur un clip où l'app ne la suit pas (#997).if next_clip_index(scene, active_clip_index).is_none()- && player.reached_end(clip.source_end_sec)?+ && player.reached_end(clip.source_end_sec, player.screen_time_sec() + acc)?{acc = 0.0;break;diff --git a/crates/compositor/src/pipeline_windows.rs b/crates/compositor/src/pipeline_windows.rsindex e71b17bbf..6baefada3 100644--- a/crates/compositor/src/pipeline_windows.rs+++ b/crates/compositor/src/pipeline_windows.rs@@ -3015,7 +3015,9 @@ mod tests {view.set_playing(false);view.set_scene(&scene);view.set_active_clip(&last, "", 0.0, 2, 0.1);- let mut gen = wait_for_frame(&view, 0, |p| p.clip_index == 2).0;+ let first_frame = wait_for_frame(&view, 0, |p| p.clip_index == 2);+ let mut gen = first_frame.0;+ let mut held = first_frame.5;// Play to the end of the last clip, then about as long again.view.set_playing(true);@@ -3024,7 +3026,15 @@ mod tests {std::thread::sleep(std::time::Duration::from_millis(150));while let Some(frame) = view.latest_frame_since(gen) {gen = frame.0;+ held = frame.5;}+ // The frame held at the end is the clip's own last frame, not the first one its cut+ // removed (the 25 fps file has a frame at exactly 0.4 s).+ assert!(+ held.source_time_sec < last_end_sec,+ "end {last_end_sec}: held a frame past the clip's end, at {:.3} s",+ held.source_time_sec+ );// A seek inside the last clip, as the app sends it while paused.view.set_time(0.2);