Przeglądaj źródła

UI: Add adv. settings checkbox for browser HW accel

Adds a checkbox to advanced settings that allows the user to
enable/disable browser source hardware acceleration on windows.
jp9000 7 lat temu
rodzic
commit
4d38e054e3

+ 3 - 0
UI/data/locale/en-US.ini

@@ -855,3 +855,6 @@ NoSources.Text.AddSource="You can add sources by clicking the + icon under the S
 # Scene item color selection
 ChangeBG="Set Color"
 CustomColor="Custom Color"
+
+# Global settings for the browser source
+BrowserSource.EnableHardwareAcceleration="Enable Browser Source Hardware Acceleration"

+ 87 - 39
UI/forms/OBSBasicSettings.ui

@@ -144,9 +144,9 @@
             <property name="geometry">
              <rect>
               <x>0</x>
-              <y>-44</y>
+              <y>0</y>
               <width>801</width>
-              <height>741</height>
+              <height>836</height>
              </rect>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_19">
@@ -797,8 +797,8 @@
              <rect>
               <x>0</x>
               <y>0</y>
-              <width>601</width>
-              <height>640</height>
+              <width>818</width>
+              <height>697</height>
              </rect>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_21">
@@ -3436,8 +3436,8 @@
              <rect>
               <x>0</x>
               <y>0</y>
-              <width>63</width>
-              <height>16</height>
+              <width>800</width>
+              <height>69</height>
              </rect>
             </property>
            </widget>
@@ -3832,8 +3832,8 @@
           <rect>
            <x>0</x>
            <y>0</y>
-           <width>98</width>
-           <height>28</height>
+           <width>818</width>
+           <height>697</height>
           </rect>
          </property>
          <layout class="QFormLayout" name="hotkeyLayout">
@@ -3850,7 +3850,7 @@
         </widget>
        </widget>
        <widget class="QWidget" name="advancedPage">
-        <layout class="QHBoxLayout" name="horizontalLayout_11">
+        <layout class="QVBoxLayout" name="verticalLayout_16">
          <property name="leftMargin">
           <number>0</number>
          </property>
@@ -3880,10 +3880,10 @@
               <x>0</x>
               <y>0</y>
               <width>803</width>
-              <height>793</height>
+              <height>807</height>
              </rect>
             </property>
-            <layout class="QVBoxLayout" name="verticalLayout_16">
+            <layout class="QVBoxLayout" name="verticalLayout_23">
              <property name="leftMargin">
               <number>0</number>
              </property>
@@ -3896,9 +3896,9 @@
              <property name="bottomMargin">
               <number>9</number>
              </property>
-             <item alignment="Qt::AlignTop">
+             <item>
               <widget class="QWidget" name="widget_11" native="true">
-               <layout class="QVBoxLayout" name="verticalLayout_17">
+               <layout class="QVBoxLayout" name="verticalLayout_24">
                 <item>
                  <widget class="QGroupBox" name="advancedGeneralGroupBox">
                   <property name="title">
@@ -4568,6 +4568,38 @@
                   </layout>
                  </widget>
                 </item>
+                <item>
+                 <widget class="QGroupBox" name="sourcesGroup">
+                  <property name="title">
+                   <string>Basic.Main.Sources</string>
+                  </property>
+                  <layout class="QFormLayout" name="formLayout_34">
+                   <property name="topMargin">
+                    <number>2</number>
+                   </property>
+                   <item row="0" column="0">
+                    <spacer name="horizontalSpacer_15">
+                     <property name="orientation">
+                      <enum>Qt::Horizontal</enum>
+                     </property>
+                     <property name="sizeHint" stdset="0">
+                      <size>
+                       <width>170</width>
+                       <height>20</height>
+                      </size>
+                     </property>
+                    </spacer>
+                   </item>
+                   <item row="0" column="1">
+                    <widget class="QCheckBox" name="browserHWAccel">
+                     <property name="text">
+                      <string>BrowserSource.EnableHardwareAcceleration</string>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
                 <item>
                  <widget class="QGroupBox" name="groupBox_17">
                   <property name="title">
@@ -4600,32 +4632,6 @@
                   </layout>
                  </widget>
                 </item>
-                <item>
-                 <widget class="QLabel" name="advancedMsg">
-                  <property name="styleSheet">
-                   <string notr="true">color: rgb(255, 0, 4);</string>
-                  </property>
-                  <property name="text">
-                   <string notr="true"/>
-                  </property>
-                  <property name="wordWrap">
-                   <bool>true</bool>
-                  </property>
-                 </widget>
-                </item>
-                <item>
-                 <widget class="QLabel" name="advancedMsg2">
-                  <property name="styleSheet">
-                   <string notr="true">color: rgb(255, 0, 4);</string>
-                  </property>
-                  <property name="text">
-                   <string notr="true"/>
-                  </property>
-                  <property name="wordWrap">
-                   <bool>true</bool>
-                  </property>
-                 </widget>
-                </item>
                </layout>
               </widget>
              </item>
@@ -4633,6 +4639,48 @@
            </widget>
           </widget>
          </item>
+         <item>
+          <layout class="QVBoxLayout" name="verticalLayout_17">
+           <property name="leftMargin">
+            <number>10</number>
+           </property>
+           <property name="topMargin">
+            <number>10</number>
+           </property>
+           <property name="rightMargin">
+            <number>10</number>
+           </property>
+           <property name="bottomMargin">
+            <number>10</number>
+           </property>
+           <item>
+            <widget class="QLabel" name="advancedMsg">
+             <property name="styleSheet">
+              <string notr="true">color: rgb(255, 0, 4);</string>
+             </property>
+             <property name="text">
+              <string notr="true"/>
+             </property>
+             <property name="wordWrap">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QLabel" name="advancedMsg2">
+             <property name="styleSheet">
+              <string notr="true">color: rgb(255, 0, 4);</string>
+             </property>
+             <property name="text">
+              <string notr="true"/>
+             </property>
+             <property name="wordWrap">
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
         </layout>
        </widget>
       </widget>

+ 14 - 0
UI/obs-app.cpp

@@ -437,6 +437,7 @@ bool OBSApp::InitGlobalConfigDefaults()
 #ifdef _WIN32
 	config_set_default_bool(globalConfig, "Audio", "DisableAudioDucking",
 			true);
+	config_set_default_bool(globalConfig, "General", "BrowserHWAccel", true);
 #endif
 
 #ifdef __APPLE__
@@ -1226,6 +1227,19 @@ bool OBSApp::OBSInit()
 		if (!StartupOBS(locale.c_str(), GetProfilerNameStore()))
 			return false;
 
+#ifdef _WIN32
+		bool browserHWAccel = config_get_bool(globalConfig, "General",
+				"BrowserHWAccel");
+
+		obs_data_t *settings = obs_data_create();
+		obs_data_set_bool(settings, "BrowserHWAccel", browserHWAccel);
+		obs_apply_private_data(settings);
+		obs_data_release(settings);
+
+		blog(LOG_INFO, "Browser Hardware Acceleration: %s",
+				browserHWAccel ? "true" : "false");
+#endif
+
 		blog(LOG_INFO, "Portable mode: %s",
 				portable_mode ? "true" : "false");
 

+ 13 - 0
UI/window-basic-settings.cpp

@@ -430,6 +430,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
 #endif
 #ifdef _WIN32
 	HookWidget(ui->disableAudioDucking,  CHECK_CHANGED,  ADV_CHANGED);
+	HookWidget(ui->browserHWAccel,       CHECK_CHANGED,  ADV_RESTART);
 #endif
 	HookWidget(ui->filenameFormatting,   EDIT_CHANGED,   ADV_CHANGED);
 	HookWidget(ui->overwriteIfExists,    CHECK_CHANGED,  ADV_CHANGED);
@@ -500,6 +501,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
 	delete ui->advancedGeneralGroupBox;
 	delete ui->enableNewSocketLoop;
 	delete ui->enableLowLatencyMode;
+	delete ui->browserHWAccel;
+	delete ui->sourcesGroup;
 #if defined(__APPLE__) || HAVE_PULSEAUDIO
 	delete ui->disableAudioDucking;
 #endif
@@ -512,6 +515,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
 	ui->advancedGeneralGroupBox = nullptr;
 	ui->enableNewSocketLoop = nullptr;
 	ui->enableLowLatencyMode = nullptr;
+	ui->browserHWAccel = nullptr;
+	ui->sourcesGroup = nullptr;
 #if defined(__APPLE__) || HAVE_PULSEAUDIO
 	ui->disableAudioDucking = nullptr;
 #endif
@@ -2295,6 +2300,10 @@ void OBSBasicSettings::LoadAdvancedSettings()
 
 	ui->enableNewSocketLoop->setChecked(enableNewSocketLoop);
 	ui->enableLowLatencyMode->setChecked(enableLowLatencyMode);
+
+	bool browserHWAccel = config_get_bool(App()->GlobalConfig(),
+			"General", "BrowserHWAccel");
+	ui->browserHWAccel->setChecked(browserHWAccel);
 #endif
 
 	bool disableFocusHotkeys = config_get_bool(App()->GlobalConfig(),
@@ -2832,6 +2841,10 @@ void OBSBasicSettings::SaveAdvancedSettings()
 
 	SaveCheckBox(ui->enableNewSocketLoop, "Output", "NewSocketLoopEnable");
 	SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable");
+
+	bool browserHWAccel = ui->browserHWAccel->isChecked();
+	config_set_bool(App()->GlobalConfig(), "General",
+			"BrowserHWAccel", browserHWAccel);
 #endif
 
 	bool disableFocusHotkeys = ui->disableFocusHotkeys->isChecked();

+ 1 - 1
plugins/obs-browser

@@ -1 +1 @@
-Subproject commit 48db938cc087d59bb4241bcf153d42a345503f8f
+Subproject commit c09562745c5dd066f7fb43e2904ea2498be558cc