From 292e893a2d067572c52a02c1a1938b57028bb362 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 4 Feb 2016 14:42:46 -0800 Subject: [PATCH] UI: Prevent video init with bad video settings A lot of people had the problem where they'd initialize video settings with 0 width or height on their output resolution value. This just changes it so that the user always has a valid resolution so video initialization doesn't just outright fail. --- obs/window-basic-main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 4ea47a8c0..78d8954f3 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -2262,6 +2262,22 @@ int OBSBasic::ResetVideo() ovi.gpu_conversion = true; ovi.scale_type = GetScaleType(basicConfig); + if (ovi.base_width == 0 || ovi.base_height == 0) { + ovi.base_width = 1920; + ovi.base_height = 1080; + config_set_uint(basicConfig, "Video", "BaseCX", 1920); + config_set_uint(basicConfig, "Video", "BaseCY", 1080); + } + + if (ovi.output_width == 0 || ovi.output_height == 0) { + ovi.output_width = ovi.base_width; + ovi.output_height = ovi.base_height; + config_set_uint(basicConfig, "Video", "OutputCX", + ovi.base_width); + config_set_uint(basicConfig, "Video", "OutputCY", + ovi.base_height); + } + ret = AttemptToResetVideo(&ovi); if (IS_WIN32 && ret != OBS_VIDEO_SUCCESS) { /* Try OpenGL if DirectX fails on windows */