Skip to content

frontend: replace Auth with YoutubeApiWrappers for YouTube callers#13482

Open
xakep8 wants to merge 3 commits into
obsproject:masterfrom
xakep8:fix/auth_cast
Open

frontend: replace Auth with YoutubeApiWrappers for YouTube callers#13482
xakep8 wants to merge 3 commits into
obsproject:masterfrom
xakep8:fix/auth_cast

Conversation

@xakep8

@xakep8 xakep8 commented May 26, 2026

Copy link
Copy Markdown

Description

Part of #13443

Updates YouTube-specific frontend code to pass YoutubeApiWrappers directly where the caller already requires YouTube auth object, instead of passing generic Auth.

Motivation and Context

OBSYoutubeActions and related YouTube-specific paths only work with the YouTube API version of Auth object. Passing generic Auth into these call sites pushes constructors to perform dynamic_cast internally when it should be the callers responsibility.

How Has This Been Tested?

xcodebuild -configuration RelWithDebInfo -scheme obs-studio -parallelizeTargets -destination "generic/platform=macOS,name=Any Mac"

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

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

@xakep8

xakep8 commented May 26, 2026

Copy link
Copy Markdown
Author

@Warchamp7 PTAL

@xakep8 xakep8 force-pushed the fix/auth_cast branch 2 times, most recently from e692a50 to 208e16d Compare May 29, 2026 08:08
@xakep8 xakep8 force-pushed the fix/auth_cast branch 5 times, most recently from 1e3b8a4 to fe076de Compare June 9, 2026 03:44
@WizardCM WizardCM added the kind/cleanup Non-breaking change which makes code smaller or more readable label Jun 10, 2026
Comment thread frontend/wizards/AutoConfigStreamPage.cpp Outdated
@xakep8 xakep8 requested a review from Warchamp7 June 12, 2026 16:11

@Warchamp7 Warchamp7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's deeper problems we need to fix here, but this is fine as a small cleanup.

@xakep8

xakep8 commented Jun 12, 2026

Copy link
Copy Markdown
Author

There's deeper problems we need to fix here, but this is fine as a small cleanup.

I could raise another PR as a follow up to this and I can clean up other places where the dynamic_cast is used.

We have a lot of scattered RTTI would it be okay if we centralize it in OBSBasic?

Edit: The question was a reference to the code in YouTubeAppDock.cpp where we have GetYTApi, which does the GetAuth and then does dynamic_cast, it would make sense if we move this to OBSBasic.

@Warchamp7

Copy link
Copy Markdown
Member

There's deeper problems we need to fix here, but this is fine as a small cleanup.

I could raise another PR as a follow up to this and I can clean up other places where the dynamic_cast is used.

We have a lot of scattered RTTI would it be okay if we centralize it in OBSBasic?

Edit: The question was a reference to the code in YouTubeAppDock.cpp where we have GetYTApi, which does the GetAuth and then does dynamic_cast, it would make sense if we move this to OBSBasic.

I'm referring more to the architectural problems of YoutubeApiWrappers being an extension of YoutubeAuth which is an extension of OAuthStreamKey which is an extension of OAuth which is an extension of Auth and all kinds of things have been bolted onto all manner of those layers. It's a mess but that's a much larger and complicated problem to fix.

@xakep8

xakep8 commented Jun 13, 2026

Copy link
Copy Markdown
Author

There's deeper problems we need to fix here, but this is fine as a small cleanup.

I could raise another PR as a follow up to this and I can clean up other places where the dynamic_cast is used.
We have a lot of scattered RTTI would it be okay if we centralize it in OBSBasic?
Edit: The question was a reference to the code in YouTubeAppDock.cpp where we have GetYTApi, which does the GetAuth and then does dynamic_cast, it would make sense if we move this to OBSBasic.

I'm referring more to the architectural problems of YoutubeApiWrappers being an extension of YoutubeAuth which is an extension of OAuthStreamKey which is an extension of OAuth which is an extension of Auth and all kinds of things have been bolted onto all manner of those layers. It's a mess but that's a much larger and complicated problem to fix.

Got it so considering this, I have a little understanding of what we are dealing with, here's something that I was thinking please let me know if this makes sense as I would like to work on solving this.

The YoutubeApiWrapper is inheriting from YoutubeAuth but considering what it does it's not really a more specific Auth object it's more off a Youtube API/broadcast client which needs OAuth data so maybe we should separate it as a YoutubeApiClient which is not a QObject and not a Auth and then we let YoutubeService own this along with a OAuthTokenStore. I also saw that the YoutubeAuth has LoadUI which does the dock creation we can move this out to a YoutubeDockController and also move broadcast setup/start/stop to YoutubeBroadcastController.

As a first cleanup, I can first work on the YoutubeApiClient part and then clean up the call sites to use YoutubeApiClient instead of the YoutubeApiWrappers.

Please suggest if I'm missing something.

@xakep8 xakep8 mentioned this pull request Jun 14, 2026
7 tasks
@xakep8

This comment was marked as outdated.

@xakep8 xakep8 requested a review from Warchamp7 June 18, 2026 02:25
@xakep8 xakep8 force-pushed the fix/auth_cast branch 6 times, most recently from b7dba96 to 995c3fd Compare June 25, 2026 19:36
xakep8 added 3 commits June 26, 2026 11:32
Created YoutubeApiClient and moved the broadcast and stream related
functions from YoutubeApiWrappers to YoutubeApiClient and added
apiClient object to YoutubeApiWrappers. This helps move the mixed
ownership issue from YoutubeApiWrappers inheriting from YoutubeAuth only
because it needs OAuth information, follow up refactor would be to move
the broadcast setup/start/stop out to YoutubeBroadcastController and
create a YoutubeService class which owns the OAuthTokenStore,
YoutubeApiClient, YoutubeBroadcastController and the
YoutubeDockController.

(cherry picked from commit c4b8cb7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Non-breaking change which makes code smaller or more readable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants