Fix media cache deadlocks when switching scenes - #1785
Open
aleksandr-voitenko wants to merge 2 commits into
Open
aleksandr-voitenko wants to merge 2 commits into
aleksandr-voitenko wants to merge 2 commits into
Conversation
Old memory manager has been rewritten from the ground. Replace per-update threads with a single worker that coalesces requests and manages cache budgets. Run media queries and cache-setting updates on the OBS graphics thread, and release source references outside locks. Cancel pending work safely during removal and shutdown. Add native tests for budgeting, readiness retries, source lifetime, and video resets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Old memory manager has been rewritten from the ground. Fixes media-cache deadlocks that can freeze scene switching and block source cleanup.
MediaCacheManagerworker that coalesces requests, manages cache reservations, and schedules bounded readiness retries.Motivation and Context
Support issue reports scene-switch freezes with animated overlays on Windows, Streamlabs Desktop 1.21.9.
A local reproduction using the supplied WebM files exposed a circular wait between media-cache workers holding different source locks. The graphics thread subsequently blocked during source activation, freezing video processing and preventing cleanup.
This change removes those competing worker locks and makes cache scheduling and source lifetime explicit. Product changes are confined to OSN and use the existing OBS media-source caching setting.
How Has This Been Tested?
Reproduced in a stand-alone test.
Tested via controlled time advances in unit tests + Manually. Windows only.
Types of changes