Commit Graph

36 Commits

Author SHA1 Message Date
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
35d4629df6 Large refactor to caching and playback timing:
- Support different speeds (-1X, 2X, 4X, etc...)
 - Clamp getFrame between 1 and timeline length
 - Support rewind using new timing code
 - Caching in both directions (based on previous speed)
 - Removing mutex from Timeline::GetFrame (cached path)
 - Caching supports actual speed now
 - Bust cache and trigger pre-roll if we encounter too many uncached frames. This will re-sync the video + audio threads.
 - Sleep less in cache loop / Adjusting min frames to 24 (trial and error). Too few and backwards playback suffers. Too many and all playback waits.
2022-02-09 17:29:04 -06:00
Jonathan Thomas
5fe398bda5 Reducing pre-roll to 12 frames 2022-02-01 15:46:35 -06:00
Jonathan Thomas
f70ca4b877 Break out of cache loop if playback speed changes during caching. Move getFrame() below pause code, to prevent accidental incrementing video_position. 2022-02-01 15:33:32 -06:00
Jonathan Thomas
176f2fff9c Big refactor of AudioReaderSource, to be simpler, and only fill the audio samples requested (removed double/internal buffer complexity). Also, we now initialize the audio device manager at a specific sampleRate and # of channels correctly. Removed 'latency' adjustment in PrivatePlayer (no longer needed with no read-ahead buffer). Increased the min_frames_required on the video cache to 24. 2022-01-31 15:18:07 -06:00
Jonathan Thomas
133bae40c3 Adding pre-roll to VideoCacheThread, and making video & audio threads wait for the isReady() method before playing. Also fixed an audio bug where our internal buffer was not being cleared on seek. Removed some unused caching from Clip, and did some minor refactor on FrameMapper/Clip cache clearing. 2022-01-26 17:56:33 -06:00
Jonathan Thomas
c55b644f70 Refactoring video playback timing to use absolute timestamps and predicted frame times, instead of relative sleep. Adjusting audio buffer smaller (less latency). 2022-01-18 13:08:32 -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
Jonathan Thomas
f3e7208df6 Adding some additional logging 2021-12-06 15:47:32 -06:00
Jonathan Thomas
09bcf2ab15 Fix sleep time calculation to change when the project profile is changed (big bug), and add some additional logging/debugging statements 2021-12-03 15:21:11 -06:00
Jonathan Thomas
4a52941708 Experimental logging to detect delay on Windows playback 2021-12-03 00:43:13 -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
FeRD (Frank Dana)
fe58e8028d Move some headers around 2021-11-01 11:04:31 -04: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
Jonathan Thomas
0c4e1bcce4 Improving performance after working with google-prof, to profile CPU. Calling OMP_MP_NUM_PROCESSORS less often, since it's quite expensive according to profiling. Adjusting Timeline final_cache to match the video caching thread max_frames, so one doesn't clobber the other. Also, fixing an issue with openshot-player, where a video file with no audio skips horribly. 2021-02-04 17:28:07 -06:00
Jonathan Thomas
47afa205c7 Merge pull request #585 from OpenShot/opencv
3 New OpenCV Effects (Tracker, Stabilization, and Object Detection)
2021-01-28 17:28:15 -06:00
FeRD (Frank Dana)
2f3615f706 Move Exceptions.h includes to .cpp files 2021-01-26 10:52:04 -05:00
Jonathan Thomas
df154c3844 Fixing color format for opencv conversion 2020-10-30 18:23:45 -05:00
Jonathan Thomas
172348417c Improvement to video caching thread, to recover from the separation of cache vs display frame #. Also found a mutex that was needed, to prevent crashing when the video thread calls timeline::GetFrame at certain times... colliding with another thread (and independent of OpenMP). 2020-10-23 17:52:20 -05:00
FeRD (Frank Dana)
aa40ea29e0 Update include paths in all source/header files 2020-10-18 07:43:37 -04:00
Frank Dana
e500cae9f5 Replace sleep()/usleep() with std::chrono calls (#473) 2020-09-02 02:07:54 -04:00
FeRD (Frank Dana)
3321042672 Raise preview cache to CPUs*8 frames, max 64 2020-01-14 00:47:02 -05:00
FeRD (Frank Dana)
43efabf102 Qt/Video*Thread: ZMQ argument stragglers 2019-10-07 13:34:02 -04:00
FeRD (Frank Dana)
f170fdd009 Update copyright range to current year 2019-06-11 06:48:32 -04:00