Skip to content

Harden playback/cache path for malformed media and concurrent timeline updates#1035

Open
jonoomph wants to merge 4 commits intodevelopfrom
caching-protections
Open

Harden playback/cache path for malformed media and concurrent timeline updates#1035
jonoomph wants to merge 4 commits intodevelopfrom
caching-protections

Conversation

@jonoomph
Copy link
Member

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.

…e 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.
@jonoomph
Copy link
Member Author

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 52.76382% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.63%. Comparing base (8c4db9a) to head (a7e9ba1).

Files with missing lines Patch % Lines
src/Qt/VideoCacheThread.cpp 37.31% 42 Missing ⚠️
src/FFmpegReader.cpp 57.31% 35 Missing ⚠️
src/AudioReaderSource.cpp 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1035      +/-   ##
===========================================
- Coverage    59.69%   59.63%   -0.06%     
===========================================
  Files          206      206              
  Lines        20567    20692     +125     
===========================================
+ Hits         12277    12340      +63     
- Misses        8290     8352      +62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

Merge conflicts have been detected on this PR, please resolve.

@github-actions github-actions bot added the conflicts A PR with unresolved merge conflicts label Feb 13, 2026
# Conflicts:
#	src/Qt/VideoCacheThread.cpp
      - Disable audio when decoder sample format is invalid (AV_SAMPLE_FMT_NONE).
      - Only synthesize channel layout when reported channels are actually valid (> 0).
  - src/AudioReaderSource.cpp
      - Added progress/validity guards in getNextAudioBlock() to prevent infinite loops on corrupt/empty audio frames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts A PR with unresolved merge conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant