Skip to content

Fix preloaded video behavior - #3206

Merged
jp9000 merged 2 commits into
obsproject:masterfrom
notr1ch:frame-fix-squashed
Jul 29, 2020
Merged

jp9000 merged 2 commits into
obsproject:masterfrom
notr1ch:frame-fix-squashed

Conversation

@notr1ch

@notr1ch notr1ch commented Jul 23, 2020

Copy link
Copy Markdown
Member

Description

This PR changes the preloading / async texture behavior in libobs. obs_source_show_preloaded_video now updates the texture when called instead of when obs_source_preload_video is called. As the only user of obs_source_preload_video, obs-ffmpeg was changed to only call obs_source_show_preloaded_video if video was actually preloaded.

Motivation and Context

Fixes broken(?) API behavior - the current behavior of obs_source_preload_video / obs_source_show_preloaded_video can fail if something else writes to the async texture in between the preload / show calls. This code is hopefully closer to what the functions were intended to do.

Fixes #2906

How Has This Been Tested?

Tested with a Media Source using a 1 FPS video with "show nothing when playback ends" and "restart playback when active" selected. No more stale frames were shown when switching scenes. Further testing may be needed as while obs-ffmpeg is the only in-tree user of obs_source_preload_video, this is still an API change that might affect plugins that call this function.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

notr1ch added 2 commits July 23, 2020 23:54
The previous preloaded video behavior updated the texture on preload
rather than when the video was shown, during which time the texture may
have been modified by other processes, resulting in the wrong frame
being displayed.
This prevents a stale texture from being visible for a single frame when
there is no preloaded video.
@notr1ch notr1ch added the Seeking Testers Build artifacts on CI label Jul 23, 2020
@jp9000
jp9000 merged commit 80bb9b4 into obsproject:master Jul 29, 2020
@therentabrain

Copy link
Copy Markdown

Noobish question: Is it appropriate to post here just to say thank you? Thank you! :)

@kimiastrid

Copy link
Copy Markdown

Noob question: how do I get an OBS version with this fix? if it requires compiling, I have no clue how to do that

@notr1ch

notr1ch commented Oct 23, 2023

Copy link
Copy Markdown
Member Author

Use any version after this was merged.

@kimiastrid

Copy link
Copy Markdown

Use any version after this was merged.

I'm using the latest version 29.1.3 and the problem persists. :/ The last frame still flashes when switching scenes, when restart playback is checked.

@notr1ch

notr1ch commented Oct 24, 2023

Copy link
Copy Markdown
Member Author

I suggest opening a new issue with full reproduction steps.

BlueCheeseburger pushed a commit to BlueCheeseburger/obs-studio that referenced this pull request Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Last frame of media source flashes before starting video playback

4 participants