obs-ffmpeg: Fix bug with last frame showing on video restart #11881
+10
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a video source is activated it appears that the last cached frame is shown before the video playback is restarted. This commit should resolve the issues #2906 and #4667. This issue occurs mainly when the the video source properties have "Show nothing when playback ends" unticked as the video will persist upon ending, then if you deactivate and reactivate the source, you'll see the last frame appear before the video restarts.
The bugged state is shown here: https://www.youtube.com/watch?v=Up3L_4YepRQ
This fixed state, with the changes, is shown here: https://www.youtube.com/watch?v=gjyV74gqOFI
To reproduce the bug in OBS v31.0, add a video media source that has an obvious, and distinct final frame compared to the first frame, activate the source and play the video, when it ends, deactivate the source, activate it and restart the video. The last frame will appear as the initial frame before the video continues to play.
Motivation and Context
It should resolve #2906 and #4667
How Has This Been Tested?
I've tested this by compiling against the current master branch with the proposed changes and activated/deactivated video sources with the multiple properties ticked and unticked. See video linked in the 'Description' above.
Hardware & OS Versions: Asus ROG Maximus XI Hero MB, i9-9900KS, 32GB RAM, RTX 3070, Win11 24H2
Types of changes
Checklist: