Print a warning if GameStream is using conflicting ports

This commit is contained in:
Cameron Gutman 2023-05-17 00:11:09 -05:00
parent f22ce25dad
commit 0f1dc1bb05

View File

@ -333,6 +333,26 @@ namespace service_ctrl {
return false;
}
} // namespace service_ctrl
/**
* @brief Checks if NVIDIA's GameStream software is running.
* @return `true` if GameStream is enabled.
*/
bool
is_gamestream_enabled() {
DWORD enabled;
DWORD size = sizeof(enabled);
return RegGetValueW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\NVIDIA Corporation\\NvStream",
L"EnableStreaming",
RRF_RT_REG_DWORD,
nullptr,
&enabled,
&size) == ERROR_SUCCESS &&
enabled != 0;
}
#endif
/**
@ -634,6 +654,14 @@ main(int argc, char *argv[]) {
std::thread httpThread { nvhttp::start };
std::thread configThread { confighttp::start };
#ifdef _WIN32
// If we're using the default port and GameStream is enabled, warn the user
if (config::sunshine.port == 47989 && is_gamestream_enabled()) {
BOOST_LOG(fatal) << "GameStream is still enabled in GeForce Experience! This *will* cause streaming problems with Sunshine!"sv;
BOOST_LOG(fatal) << "Disable GameStream on the SHIELD tab in GeForce Experience or change the Port setting on the Advanced tab in the Sunshine Web UI."sv;
}
#endif
rtsp_stream::rtpThread();
httpThread.join();