Commit Graph

11 Commits

Author SHA1 Message Date
Jonathan Thomas 543c58de63 - Timeline::GetFrame no longer clamps past-end requests to MaxFrame; it returns requested past-end black frames but does not cache them, so scrubbing past end no longer pollutes final_cache.
- VideoCacheThread now preserves raw playhead intent while clamping only for cache/readiness internals, and playback click behavior was corrected so non-preroll playback seeks don’t clear cache unexpectedly.
2026-03-04 23:49:47 -06:00
Jonathan Thomas 7b7d3d2090 Removing end of timeline handling/checks in video cache thread, since we now clamp Timeline::GetFrame correctly. 2026-03-04 17:58:37 -06:00
Jonathan Thomas 4db8047bbb Clamping video cache thread to timeline max frame, so we don't churn/invalidate the cache at the very end of the timeline for no reason. Also, clamping Timeline::GetFrame to the max frame on the timeline, so we don't waste resources generating black frames past the end frame. 2026-03-04 13:17:47 -06:00
Jonathan Thomas 3a50b9afc2 Paused and playback seek behavior now follows one rule: keep cache on in-range seeks, rebuild only on out-of-range seeks. 2026-03-01 22:49:31 -06:00
Jonathan Thomas 4387f8b394 - Timeline composition no longer mutates cached clip frames (fixes trails/ghosting).
- Clip updates via ApplyJsonDiff now also clear clip cache (not just timeline/reader ranges).
- Added regressions for cache invalidation + no cached-frame mutation; kept paused preroll/cache-bar behavior intact.
2026-03-01 14:19:27 -06:00
Jonathan Thomas ff22d416da - Playback updates no longer act like seeks.
- Scrubbing inside cached area keeps cache.
- Scrubbing outside cached area clears cache immediately.
- Preroll now starts on seek commit (release), not during drag.
- Temporary debug logs were removed.
- Tests were added for these behaviors.
2026-02-26 13:22:06 -06:00
Jonathan Thomas c43092eaa5 Merge branch 'develop' into caching-protections
# Conflicts:
#	src/Qt/VideoCacheThread.cpp
2026-02-13 11:29:32 -06:00
Jonathan Thomas fb41a3c479 • - Fix VideoCacheThread::isReady() so preroll readiness is clamped by frames actually available to the timeline boundary (end/start), preventing playback from stalling in PLAY near the end.
- Add regression coverage in tests/VideoCacheThread.cpp (isReady: clamps preroll requirement at timeline boundaries) for forward-near-end and backward-near-start cases.
2026-02-12 23:41:51 -06:00
Jonathan Thomas d70e80eac4 Harden playback/cache path for malformed media and concurrent timeline updates
- Invalidate timeline cache on ApplyJsonDiff() clip insert (remove affected frame range).
  - Add lock in Timeline::ClearAllCache() for safe concurrent access.
  - Make VideoCacheThread cross-thread state safe (atomics + seek-state mutex).
  - Lock CacheMemory::Contains() to avoid races.
  - Handle malformed audio streams in FFmpegReader by disabling invalid audio and continuing video-only.
  - Add FPS/timebase safety fallbacks in FFmpeg frame/PTS math.
  - Guard Frame::GetSamplesPerFrame() against invalid inputs.
  - Add/adjust regression tests for cache invalidation and invalid rate handling.
2026-02-11 20:11:47 -06:00
Jonathan Thomas 43f9ed89ae VideoCacheThread: add directional preroll
- start cache rebuilds with a preroll offset (settings-based)
- tighten isReady to require frames ahead/behind playhead add unit tests for preroll clamping and readiness
2026-02-05 12:39:06 -06:00
Jonathan Thomas 364fb37565 Unit tests for new VideoCacheThread, to test all helper methods and ensure our general logic is correct (caching forward and backwards) 2025-06-03 22:24:34 -05:00