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

UI: Fix crash when exiting with a multitrack video stream active #10890

Closed
wants to merge 1 commit into from

Conversation

palana
Copy link
Contributor

@palana palana commented Jun 19, 2024

Not entirely sure if this is a good fix/the right fix, commit title etc is somewhat not final cc @tt2468, @RytoEX

Description

changes order that multitrack video output encoders and outputs are released in, to work around a crash on shutdown while the multitrack video output is active

Motivation and Context

exiting obs while the multitrack video output is active will currently cause obs to crash:
code around the crash

if (encoder->encoder_group->destroy_on_stop)
obs_encoder_group_actually_destroy(
encoder->encoder_group);

-> remove_connection calls obs_encoder_group_actually_destroy which in turn releases the last strong ref to the current encoder so encoder is an invalid pointer in remove_connection after that point, and it currently crashes in pthread_mutex_unlock(&encoder->encoder_group->mutex) for me

How Has This Been Tested?

exited obs with multitrack video output active and it no longer crashes

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.

Not entirely sure if this is a good fix/the right fix
@RytoEX RytoEX requested review from derrod and tt2468 June 19, 2024 16:18
@RytoEX RytoEX self-assigned this Jun 19, 2024
@RytoEX RytoEX added the Bug Fix Non-breaking change which fixes an issue label Jun 19, 2024
@RytoEX RytoEX added this to the OBS Studio 30.2 milestone Jun 19, 2024
@RytoEX RytoEX requested a review from notr1ch June 19, 2024 16:19
* so the output needs to be stopped/released
* before the encoders are released
*/
OBSOutputAutoRelease output_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really a fan of how this relies on implicit c++ delete behavior to keep libobs from crashing. I'm looking into if it's possible to solve the issue from the libobs side.

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.

None yet

3 participants