Check preview output instead of is_running to prevent leaks#1377
Conversation
|
Should we update this on the main_output ? Should we revise the is_running for this purpose everywhere too? |
|
When I did this I verified the issue did not exist on Main. However, for the sake of consistency, I went ahead and dug into the differences between starting and stopping main and preview output and found that preview did not report the error and stop the output if it was not able to create the ndi output when the name was already used (by another instance of OBS). So I added code to stop the preview output if it was not created. I also checked context.output instead of context.is_running when stopping main output. FYI: Filter output does not use the obs_output pipeline, no audio thread started, so nothing to do in that part of the code. |
There was a problem hiding this comment.
Have confirmed the audio thread does not leak when creating preview output with the same name as and existing output (ie. main). Also added the code recommended in the issue discussion to bdupstr the ndi_name for OBS voi and aoi info as suggested in the original issue. This is just to be correct and not cause any doubt when finding issues with output from DistroAV.
This fixes #1335 by checking for the existence of preview output instead of is_running. The is_running check was causing a leak of the audio thread.
This can be duplicated by launching an OBS and turning on preview output in DistroAV Output Settings. In another OBS, also turn on Preview Output with the same NDI name as the first OBS. This does not create a sender because one already exists with the same name. When the second OBS Preview Output, which was not created, is turned off, it doesn't close the preview output because it is not actually running. The output was created, it just wasn't running.
The fix is to check if the output exists instead of checking if it is running.