#329: superseded viewer frames call off their footage decodes
Problem: scrubbing a long movie showed the frame under the pointer seconds after the pointer stopped. Every viewer frame a free frame-pool thread had started kept running: each seeked the movie's one decoder and decoded up to a GOP, and the newest frame waited behind all of them on the decoder's lock (45 min 1080p H.264/HEVC, GOP 250: 1.8-3.6 s for the last frame of a drag; a single jump is 0.1-0.4 s). FilmCraft's decoder already polls a cancellation flag, but nothing set one. Fix: FootageSource::cancellable / called_off and CancellableFootage (a per-render view whose frame reads run under the render's own flag, so reads on other threads answer to the right render). MediaPool runs them under filmcraft_media::cancel::with_cancel. The frame workers render through it, and a newer viewer frame calls off the comp's running viewer frames of other times. A called-off render is not cached (frames, disk, layer cache). Drag latency is now 0.1-0.3 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a7d3e7699
commit
a0decc80dd
@@ -268,6 +268,23 @@ fn render_cached(p: &Project, cid: ItemId, t: Tick, cache: Option<&crate::LayerC
|
||||
r.comp_frame(cid, t)
|
||||
}
|
||||
|
||||
/// #329: a render whose footage reads were called off keeps nothing in the layer cache: a layer
|
||||
/// made from a frame that came back empty (an effect's layer parameter) would be reused by the
|
||||
/// next render of that time.
|
||||
#[test]
|
||||
fn a_called_off_render_keeps_nothing_in_the_layer_cache() {
|
||||
let (p, cid) = cache_scene();
|
||||
let t = Tick::from_seconds_f64(0.5);
|
||||
let cache = crate::LayerCache::default();
|
||||
let off = crate::CancellableFootage { inner: &crate::NoFootage, cancel: std::sync::Arc::new(std::sync::atomic::AtomicBool::new(true)) };
|
||||
let mut r = crate::Renderer::new(&p, &off, crate::RenderOpts::default());
|
||||
r.cache = Some(&cache);
|
||||
r.comp_frame(cid, t);
|
||||
assert_eq!(cache.stats().entries, 0, "a called-off render kept layers");
|
||||
render_cached(&p, cid, t, Some(&cache));
|
||||
assert!(cache.stats().entries > 0, "a render that runs to the end keeps its layers");
|
||||
}
|
||||
|
||||
/// [`add_effect`] for a 200×100 layer.
|
||||
fn add_effect_200(p: &mut Project, l: &mut effectcraft_project::Layer, id: &str, vals: &[(&str, Value)]) {
|
||||
add_effect(p, l, id, [200.0, 100.0], vals);
|
||||
|
||||
Reference in New Issue
Block a user