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.
This commit is contained in:
Jonathan Thomas
2026-02-11 20:11:47 -06:00
parent 57c1fb2ec3
commit d70e80eac4
9 changed files with 238 additions and 83 deletions

View File

@@ -36,12 +36,12 @@ public:
using VideoCacheThread::handleUserSeekWithPreroll;
using VideoCacheThread::computePrerollFrames;
int64_t getLastCachedIndex() const { return last_cached_index; }
void setLastCachedIndex(int64_t v) { last_cached_index = v; }
void setPlayhead(int64_t v) { requested_display_frame = v; }
void setMinFramesAhead(int64_t v) { min_frames_ahead = v; }
void setLastDir(int d) { last_dir = d; }
void forceUserSeekFlag() { userSeeked = true; }
int64_t getLastCachedIndex() const { return last_cached_index.load(); }
void setLastCachedIndex(int64_t v) { last_cached_index.store(v); }
void setPlayhead(int64_t v) { requested_display_frame.store(v); }
void setMinFramesAhead(int64_t v) { min_frames_ahead.store(v); }
void setLastDir(int d) { last_dir.store(d); }
void forceUserSeekFlag() { userSeeked.store(true); }
};
// ----------------------------------------------------------------------------