Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libobs: Do not attempt to reconnect if stop event is set #11296

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dsaedtler
Copy link

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 prevent obs_output_active() from returning true 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:

  1. Start ffmpeg -f flv -listen 1 -i rtmp://127.0.0.1:1935/live/test -c copy -f null -
  2. Connect with OBS
  3. Stop/kill ffmpeg (e.g. by pressing "q" with the terminal in focus)
  4. Wait for OBS to start reconnecting
  5. Hit "Stop Streaming" at just the right time

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

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@WizardCM WizardCM added the Bug Fix Non-breaking change which fixes an issue label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants