libobs: Do not attempt to reconnect if stop event is set #11296
+6
−0
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.
Description
Prevents the reconnect thread from being started up again after the output has been put into the "stopping" state and reconnects have been requested to stop. Also sets the reconnect state to
false
to preventobs_output_active()
from returningtrue
which would prevent the multitrack output's stop handler from continuing.Motivation and Context
Should fix the crash reported on the EB Discord related to the output teardown not actually running due to the output still being in a reconnected state: https://discord.com/channels/1171528364000018442/1282992330604941365
This is a race condition that requires the right timing to trigger. It would also leave the
reconnect_thread
in a non-detached state while never being joined.Technically it should also be possible to remove this check now that #11117 is merged without causing more issues, but I wanted to fix the underlying race condition in libobs first.
How Has This Been Tested?
Locally with OBS connecting to FFmpeg in listener mode:
ffmpeg -f flv -listen 1 -i rtmp://127.0.0.1:1935/live/test -c copy -f null -
WIthout this patch OBS will be in a bad state where the output hasn't been destroyed, and attempting to start it again will cause a crash. With this patch the output should be correctly cleaned up.
Types of changes
Checklist: