libobs/frontend: Add callback for reconnection decision #11925
+67
−3
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
Adds a callback for making reconnection decision.
Also reverts #11304
Motivation and Context
#11304 was necessary for #11452, but negatively impacted regular users as some servers would not accept a reconnection attempt after the default retry time (2 seconds), which resulted in some users seeing a warning message instead of automatic reconnection.
To restore the old behaviour, we instead add a new callback that makes it a decision by the output's creator on whether or not they want to allow a reconnect attempt.
In addition to a simple yes/no decision this also allows reconfiguring the output in the callback, allowing for a futrue rework of #11452 that does not rely on the somewhat ugly UI changes to hijack the regular disconnect logic and instead updates the output in-place before returning.
How Has This Been Tested?
Verified regular output still works fine. Will need more testing.
Types of changes
Checklist: