Hi,
I was fiddling with the OBS API to duplicate sources on-the-fly and found a bug. Or maybe I'm not doing it right.
With a plugin I just create a duplicated source from a webcam and at the moment of creation I set the source invisible. The problem is that some times the source leaks one frame before turning invisible.
This is an example code:
No callbacks, no nothing in between.
These are the timings:
- Duplicate source with this code, set visibility to false and change its position. Leak occurs.
- Wait 300 ms.
- Set visibility to true.
- Wait 200 ms.
- Delete element.
- Wait 500 ms.
- Loop again
And with that you can see that sometimes the frame is leaked on creation: https://vgy.me/CzKjfA.gif
(Sorry about my hair. It wasn't combed xD)
I was fiddling with the OBS API to duplicate sources on-the-fly and found a bug. Or maybe I'm not doing it right.
With a plugin I just create a duplicated source from a webcam and at the moment of creation I set the source invisible. The problem is that some times the source leaks one frame before turning invisible.
This is an example code:
C++:
obs_source_addref(fromSource); // Add reference
obs_sceneitem_t* newItem = obs_scene_add(obs_scene_from_source(toScene), fromSource); // Add the source to another scene
obs_sceneitem_set_visible(newItem, false); // Set new source visibility
/* [...] Set position [...] */
No callbacks, no nothing in between.
These are the timings:
- Duplicate source with this code, set visibility to false and change its position. Leak occurs.
- Wait 300 ms.
- Set visibility to true.
- Wait 200 ms.
- Delete element.
- Wait 500 ms.
- Loop again
And with that you can see that sometimes the frame is leaked on creation: https://vgy.me/CzKjfA.gif
(Sorry about my hair. It wasn't combed xD)