Commit Graph

44 Commits

Author SHA1 Message Date
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 f3c4504662 Improve benchmark regression caused by aggressive memory trimming, and caches that were too small. A new debounce strategy for memory trimming (1 time max per 30 seconds). 2026-02-06 23:11:00 -06:00
Jonathan Thomas 7fdd145dc2 Adding new memory trimming to more forcefully return memory to the OS after major memory clearing events (i.e. clearing all cache, closing readers, or large amounts of cache cleared). Also, refactoring default cache sizes in Timeline, FrameMapper, and FFmpegReader to better support high frame rate and high resolution videos (i.e. 4k 60 fps) so we don't immediately run out of memory. 2025-12-14 23:53:36 -06:00
Jonathan Thomas 06ddfc1320 Add virtual Touch() function to CacheBase, and rename MoveToFront in CacheMemory.cpp and CacheDisk.cpp to Touch. 2025-06-03 09:24:16 -05:00
Jonathan Thomas 8a3e2eb2d0 Refactor of cache code, and fixed a crash generating Json from an empty cache object. 2022-09-15 18:29:43 -05:00
Jonathan Thomas 9202d94ee6 Fixing whitespace issues (converting spaces back to tabs... for now) 2022-07-21 15:00:08 -05:00
Jonathan Thomas d243db8aaa Adding new GetFrames method to CacheBase, to return an ordered vector of Frame objects. Useful when needing to iterate through the current cached frames. 2022-06-25 17:32:36 -05:00
Jonathan Thomas d24e39407e Prevent crashes:
- Tweaking GetSmallestFrame to not use an additional mutex.
- Replace 2 mutex on Timeline::GetFrame with 1 mutex.
- Remove mutex from Timeline::ClearAllCache.
- Slow down loop on video cache thread.
- Protect audioThread::Seek() if missing a source.
- Rearrange StopPlayback to always stop the videoCache thread first.
2022-02-12 13:31:21 -06:00
Jonathan Thomas 32347a4c60 Fixing memory issues with FrameMapper, Cache, and Keyframe objects (which use vectors that can hold tons of objects, and were not fully releasing the memory on the heap until the program terminates) 2022-02-02 18:32:47 -06:00
Jonathan Thomas a5f35fb42a Refactoring the VideoCacheThread to check every frame before requesting it. Adding a new method: Contains() to our cache objects, to facilitate this. Removing cache clearning experimental code from Timeline (causing playback issues). Refactoring PrivatePlayer playback timing code, to calculate an average # of frame difference between audio and video threads, and slowly adjust back towards zero when needed. 2022-01-14 15:16:04 -06:00
FeRD (Frank Dana) 59108504e3 Code changes for compatibility with JUCE 6.x
- Replace all juce::CriticalSection with std::recursive_mutex
- Replace all juce::AudioSampleBuffer with juce::AudioBuffer<float>
- Eliminate implicit reliance on 'using namespace juce;'
- Replace OpenShotAudio.h includes with targeted juce modules
2021-11-09 06:22:25 -05:00
Jonathan Thomas f81f620c2a Merge pull request #732 from ferdnyc/crop-qpainter
Rewrite Crop effect using QPainter
2021-10-29 13:17:38 -05:00
Frank Dana 59138ea3e4 Adopt license management via Reuse project/tool (#711)
* reuse-managed license/copyright headers

reuse is a tool for compliance with the REUSE recommendations. See
<https://reuse.software/> for more information, and
<https://reuse.readthedocs.io/> for the online documentation.

* Set jsoncpp license
* Add MIT license for Decklink sources
* Explicitly license examples/
  - Add headers to source files
  - Change blanket licensing in .reuse/dep5 to only cover binary media
  - Import CC-BY-3.0 license and assign to sintel_trailer
2021-10-16 01:26:26 -04:00
Jonathan Thomas 2e8c74e8aa Prevent crash when smallest frame detected in memory object is NULL 2021-10-07 13:34:00 -05:00
FeRD (Frank Dana) 42e7049e6d Cleanup includes to reflect actual dependencies 2021-09-18 08:37:22 -04:00
FeRD (Frank Dana) 2f3615f706 Move Exceptions.h includes to .cpp files 2021-01-26 10:52:04 -05:00
FeRD (Frank Dana) aa40ea29e0 Update include paths in all source/header files 2020-10-18 07:43:37 -04:00
Frank Dana 8ea7449363 Merge branch 'develop' into json-parsing 2020-01-20 15:25:40 -05:00
FeRD (Frank Dana) e49f62247e Use C++11 range-based for loops where we can 2019-12-28 09:50:09 -05:00
FeRD (Frank Dana) 22bf6edfba Enhance Json data handling
- Parsing from string to Json::Value is now done by utility function
  openshot::stringToJson() in Json.cpp, all SetJson() methods call it.
- Expand use of const member functions and args where appropriate.
- Use std::to_string() to format int/float values as strings.
- Correct mentions of nonexistent Json::JsonValue type in docstrings
2019-12-27 08:51:51 -05:00
Frank Dana 8bde07682c Merge branch 'develop' into std-prefixes 2019-10-22 21:00:27 -04:00
FeRD (Frank Dana) 366ff2c5e6 src: Don't pass "" file_path args to exceptions 2019-08-27 15:47:39 -04:00
FeRD (Frank Dana) b6b832fb81 std:: prefixes for CacheBase/Disk/Memory 2019-08-04 22:34:24 -04:00
Jonathan Thomas 5f331e24df Merge pull request #265 from ferdnyc/catch-by-reference
Exceptions: catch-by-reference and other cleanup
2019-07-29 16:27:40 -05:00
FeRD (Frank Dana) 35eb6adc55 Clean up allocated memory in JSON code 2019-07-11 05:00:47 -04:00