bazukas / obs-linuxbrowser

OBS Linux Browser Plugin
GNU General Public License v2.0
497 stars 48 forks source link

"Stop browser while hidden" setting is being ignored when restarting OBS studio 23.2.1 #112

Open ntoff opened 4 years ago

ntoff commented 4 years ago

When starting up OBS studio 23.2.1, all the browser processes are spawned and result in over 30% CPU usage, even though the setting to hide the browsers is checked. Using version 0.6.1 of the linuxbrowser plugin.

If I manually open each source, and untick -> re-tick the box, the browser processes will then close when hidden, resulting in a CPU usage of around 2%.

It seems like the setting "works", but as soon as OBS studio is restarted, it just ignores the setting entirely and spawns all the browser processes even if they aren't visible or even included in the current scene.

MichaelTunnell commented 4 years ago

I have this same issue however I have like 25+ browser sources so my CPU usage is 95% - 100% so I have to open my task manager and kill these processes after every launch of OBS.

NexAdn commented 4 years ago

The problem is caused by OBS not calling the show/hide callbacks initially after creating the source. Unfortunately I haven't found a way to detect if the source is shown or hidden on source creation.

A workaround would be to not spawn the browser process upon creation but rather when the source is being shown or hidden. This would, however, cause the browser to not spawn automatically if the source is already being shown somewhere. In other words, to make the browser appear, one would have to hide and re-show the source if it's on one of the scenes which are being shown on startup of OBS. I think this is not a bad compromise, but I'd like to implement it in a way that this is only done if browsers are set to be killed upon hiding.