Ver código fonte

UI: Fix misleading log message when updating settings

While an output is active, the user may try to reset the settings in the
settings window, causing a misleading error message to be thrown in the
log indicating that it's "falling back" to OpenGL.

Instead, if an output is currently active, do not reset video.
jp9000 8 anos atrás
pai
commit
0697e37b26
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      UI/window-basic-main.cpp

+ 9 - 0
UI/window-basic-main.cpp

@@ -2692,6 +2692,9 @@ static inline enum video_format GetVideoFormatFromName(const char *name)
 
 int OBSBasic::ResetVideo()
 {
+	if (outputHandler && outputHandler->Active())
+		return OBS_VIDEO_CURRENTLY_ACTIVE;
+
 	ProfileScope("OBSBasic::ResetVideo");
 
 	struct obs_video_info ovi;
@@ -2742,6 +2745,12 @@ int OBSBasic::ResetVideo()
 
 	ret = AttemptToResetVideo(&ovi);
 	if (IS_WIN32 && ret != OBS_VIDEO_SUCCESS) {
+		if (ret == OBS_VIDEO_CURRENTLY_ACTIVE) {
+			blog(LOG_WARNING, "Tried to reset when "
+			                  "already active");
+			return ret;
+		}
+
 		/* Try OpenGL if DirectX fails on windows */
 		if (astrcmpi(ovi.graphics_module, DL_OPENGL) != 0) {
 			blog(LOG_WARNING, "Failed to initialize obs video (%d) "