Browse Source

UI: Add max cx/cy/fps clamp (if service specifies)

jp9000 5 years ago
parent
commit
6af26d3290
1 changed files with 16 additions and 0 deletions
  1. 16 0
      UI/window-basic-auto-config-test.cpp

+ 16 - 0
UI/window-basic-auto-config-test.cpp

@@ -1013,6 +1013,22 @@ void AutoConfigTestPage::FinalizeResults()
 		obs_service_apply_encoder_settings(service, vencoder_settings,
 						   nullptr);
 
+		int maxCX, maxCY, maxFPS;
+		obs_service_get_max_res_fps(service, &maxCX, &maxCY, &maxFPS);
+
+		if (maxCX && wiz->idealResolutionCX > maxCX)
+			wiz->idealResolutionCX = maxCX;
+		if (maxCY && wiz->idealResolutionCY > maxCY)
+			wiz->idealResolutionCY = maxCY;
+		if (maxFPS) {
+			double idealFPS = (double)wiz->idealFPSNum /
+					  (double)wiz->idealFPSDen;
+			if (idealFPS > (double)maxFPS) {
+				wiz->idealFPSNum = maxFPS;
+				wiz->idealFPSDen = 1;
+			}
+		}
+
 		wiz->idealBitrate =
 			(int)obs_data_get_int(vencoder_settings, "bitrate");