Repository navigation
fix video texture leaks - #2108
Merged
Merged
Conversation
The smoke test now closes its video on another thread, while its last frame is still shown, and checks that its GL textures are gone once a second video reads a frame on the GL thread. With hxcpp and HashLink, it also drops a video without closing it and collects it on another thread.
Each backend now releases the GL objects it left from closing away from the GL thread in its own ReleaseOrphans, called before a texture frame is read there. This replaces a function pointer that was set under a lock and read without one. The lists of what was left are never destroyed, as exiting on Android and Linux runs static destructors while threads can still be closing videos. Media Foundation unlocks the frame that was shown when it closed before releasing it, as closing on the GL thread does, rather than relying on the driver to unregister a locked object.
A macOS backend closed or collected away from the GL thread kept its textures and framebuffers, or forgot them when destroyed. They are now deleted the next time a texture frame is read where their context is current. iOS frames give back their own textures, so it leaves nothing.
A backend closed or collected away from the GL thread dropped its copy texture, image texture, framebuffer, program, buffer and vertex array. They are now deleted the next time a texture frame is read where their context is current.
Member
|
Looks good. Thanks! |
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.
GL texture leak in VideoDecoder: if Close() ran outside the GL thread (for example when the GC finalized an unclosed decoder), its texture was dropped and never deleted.
GPU leak in MFVideoBackend: closing off the GL thread dropped the shared D3D11 textures, the WGL interop handles, the GL textures and the interop device without releasing them.
Both are now queued and released on the next texture read on the GL thread.
Data race: audioTime is written by the audio thread and read by the main thread, so it is now atomic.