fix(app): playback tracks the playhead after stalls - clamp, prune, never teleport
Two compounding causes behind 'playhead advances but the picture stays frozen' and 'pause freezes the app': - The wall-anchored clock teleported the playhead past the pre-render window during any long stall (the first render after pressing play costs seconds while the worker pool spins up: measured +104 frames in one 4.1s block). The window then started behind and, with stale in-flight frames occupying the workers, never converged. RealClock::tick now clamps the advance to 2 frames/tick and re-anchors the dropped time (NLE drop-frames semantics). - Window frames the playhead had already passed stayed pending/in flight, burning worker time on frames that could never be displayed. update_preview_window now cancels them per tick via the new JobDispatch::cancel_preview_frame, keeping the workers on frames around the playhead. Includes a production-shaped regression test (real 1080p media on the timeline, actual cpu_frame display path) that failed with the exact production signature (playhead 240 / displayed 0 / 36 stale slots) before the fix and passes after.
This commit is contained in:
@@ -1609,6 +1609,16 @@ impl JobDispatch for ProcessDispatcher {
|
||||
Some(self.preview_window_capacity())
|
||||
}
|
||||
|
||||
/// Cancel one pre-render window frame (delegates to the inherent
|
||||
/// [`ProcessDispatcher::cancel_frame`]).
|
||||
fn cancel_preview_frame(&self, sequence: u64, frame: i64, version: u64) {
|
||||
self.cancel_frame(&FrameKey {
|
||||
sequence,
|
||||
frame,
|
||||
version,
|
||||
});
|
||||
}
|
||||
|
||||
/// Release a consumed frame's slot (delegates to the inherent
|
||||
/// release — see [`ProcessDispatcher::release_frame`]).
|
||||
fn release_frame(&self, frame: &ShmFrameRef) {
|
||||
|
||||
@@ -155,6 +155,11 @@ pub trait JobDispatch: Send + Sync {
|
||||
fn preview_window_capacity(&self) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Cancel one pre-render window frame by scheduler key (pending or in
|
||||
/// flight; the completion fires `Error::State`). Default no-op: only
|
||||
/// the process backend schedules.
|
||||
fn cancel_preview_frame(&self, _sequence: u64, _frame: i64, _version: u64) {}
|
||||
}
|
||||
|
||||
/// Thread-free job dispatcher (M15 S2). Executes jobs on the calling
|
||||
|
||||
Reference in New Issue
Block a user