-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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: Update profile encoder information after module load #11465
Conversation
Hello, thank you for working on this issue. I have tested this, and I have mixed results to report. First half of results: The originally reported steps to reproduce are fixed by this change. 👍 Testing details and notes (click to expand if you want):Before this change, WITH this change, Checked with Visual Studio on Windows 10 for debugging purposes, and confirmed the fix with the PR's CI-generated binary as well. Second half of results: Unfortunately, there is now a crash ❌ upon making a new profile (menu, "Profile" -> "New" in the UI, enter a name and press "OK"), as Call stack of get_simple_output_encoder() when the access error occurs (when making a new Profile) (click to expand):ucrtbased.dll!00007ffe207560c0()
obs64.exe!get_simple_output_encoder(const char * encoder) Line 549
at C:\Users\User\obs-studio\UI\window-basic-main-outputs.cpp(549)
obs64.exe!SimpleOutput::SimpleOutput(OBSBasic * main_) Line 647
at C:\Users\User\obs-studio\UI\window-basic-main-outputs.cpp(647)
obs64.exe!CreateSimpleOutputHandler(OBSBasic * main) Line 2531
at C:\Users\User\obs-studio\UI\window-basic-main-outputs.cpp(2531)
obs64.exe!OBSBasic::ResetOutputs() Line 1999
at C:\Users\User\obs-studio\UI\window-basic-main.cpp(1999)
obs64.exe!OBSBasic::ResetProfileData() Line 748
at C:\Users\User\obs-studio\UI\window-basic-main-profiles.cpp(748)
obs64.exe!OBSBasic::ActivateProfile(const OBSProfile & profile, bool reset) Line 709
at C:\Users\User\obs-studio\UI\window-basic-main-profiles.cpp(709)
obs64.exe!OBSBasic::SetupNewProfile(const std::string & profileName, bool useWizard) Line 79
at C:\Users\User\obs-studio\UI\window-basic-main-profiles.cpp(79)
obs64.exe!OBSBasic::on_actionNewProfile_triggered() Line 445
at C:\Users\User\obs-studio\UI\window-basic-main-profiles.cpp(445)
obs64.exe!OBSBasic::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 3435
at C:\Users\User\obs-studio\build_x64\UI\obs-studio_autogen\include_Debug\EWIEGA46WW\moc_window-basic-main.cpp(3435)
obs64.exe!OBSBasic::qt_metacall(QMetaObject::Call _c, int _id, void * * _a) Line 3725
at C:\Users\User\obs-studio\build_x64\UI\obs-studio_autogen\include_Debug\EWIEGA46WW\moc_window-basic-main.cpp(3725)
[External Code]
obs64.exe!OBSApp::notify(QObject * receiver, QEvent * e) Line 1438
at C:\Users\User\obs-studio\UI\obs-app.cpp(1438)
[External Code]
obs64.exe!OBSApp::notify(QObject * receiver, QEvent * e) Line 1438
at C:\Users\User\obs-studio\UI\obs-app.cpp(1438)
[External Code]
obs64.exe!run_program(std::basic_fstream<char,std::char_traits<char>> & logFile, int argc, char * * argv) Line 2102
at C:\Users\User\obs-studio\UI\obs-app.cpp(2102)
obs64.exe!main(int argc, char * * argv) Line 2639
at C:\Users\User\obs-studio\UI\obs-app.cpp(2639)
obs64.exe!qtEntryPoint() Line 50
at D:\a\obs-deps\obs-deps\windows_build_temp\qt6\qtbase\src\entrypoint\qtentrypoint_win.cpp(50)
obs64.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 60
at D:\a\obs-deps\obs-deps\windows_build_temp\qt6\qtbase\src\entrypoint\qtentrypoint_win.cpp(60)
[External Code] |
The function InitBasicConfigDefaults2's purpose is to set up encoder- related settings for a profile, which requires all available encoders to have been discovered first. As encoders are added by runtime modules, this also means that discovery needs to be delayed until after modules have been loaded, but modules themselves require a valid profile to exist and be loaded. This leads to the requirement of profiles needing to exist in a half-initialized state when modules are loaded and only becoming fully initialized after that. This distinction is not necessary after the initial launch of obs-studio because runtime plugins are not hot-loadable, so the update can happen unconditionally at any time a plugin is changed, which implicitly couples every call to ActivateProfile with a call to UpdateProfileEncoders.
ff675f7
to
f0b9199
Compare
Pushed an update, please check the use cases again once CI has finished creating the artefacts. |
Okay, with the latest change, all looks good to me. 👍
I confirmed the above with this branch checked out in debug mode in Visual Studio on Windows 10, as well as with the PR's CI binary (also on Windows 10, same machine). (Flow of code execution stepping through in a debugger seems reasonable to me also, though I'm not super familiar with the code admittedly. Nothing stood out as being off, end-user-apparent behavior seemed pretty much the same as 30.2.3 as far as I could tell.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay at a glance.
Description
Splits the initialisation of encoder information for a loaded profile from the profile activation as encoder information is not available at the time of activation during program initialisation.
Motivation and Context
The function
InitBasicConfigDefaults2
's purpose is to set up encoder-related settings for a profile, which requires all available encoders to have been discovered first.As encoders are added by runtime modules, this also means that discovery needs to be delayed until after modules have been loaded, but modules themselves require a valid profile to exist and be loaded.
This leads to the requirement of profiles needing to exist in a half-initialized state when modules are loaded and only becoming fully initialized after that.
This distinction is not necessary after the initial launch of obs-studio because runtime plugins are not hot-loadable, so the update can happen unconditionally at any time a plugin is changed, which implicitly couples every call to
ActivateProfile
with a call toUpdateProfileEncoders
.Fixes #11464.
How Has This Been Tested?
Tested with profiles using hardware H264 and HEVC encoders and checked that their selection was retained after closing and opening OBS as well as switching between different profiles that had any encoder except for X264 configured and checked that those profiles' encoder settings were also kept.
Types of changes
Checklist: