mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-23 17:02:10 -04:00
The obs_source::async_reset_texture variable can cause a data race between threads to occur because it could be set to true in one thread then changed back to false in another thread. This could cause the async texture to not update its size when it's supposed to, which can cause a crash or corruption when copying data from a frame of a differing size. The solution to this is to: - Delete the async_reset_texture variable, and make the set_async_texture_size function change the texture size if the async_width, async_height, or async_format variables differ from the frame's width/height/format. Those variables are then only ever set in the libobs graphics thread. - Make the cache_video function use separate variables from other functions to detect a change in size (due to the fact that the texture size should only be resized in the libobs graphics thread). These variables are async_cache_width, async_cache_height, and async_cache_format, which are only be set in the thread that calls obs_source_output_video. How to replicate the data race: - On OSX, use window capture on a textedit window, then continually resize the textedit window.