UI: Add options for new socket loop

This commit is contained in:
derrod 2017-02-22 02:05:45 +01:00 committed by jp9000
parent f8617bd359
commit 379b41aa0e
5 changed files with 214 additions and 99 deletions

View file

@ -605,6 +605,8 @@ Basic.Settings.Advanced.StreamDelay.Preserve="Preserve cutoff point (increase de
Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimated Memory Usage: %1 MB"
Basic.Settings.Advanced.Network="Network"
Basic.Settings.Advanced.Network.BindToIP="Bind to IP"
Basic.Settings.Advanced.Network.EnableNewSocketLoop="Enable new networking code"
Basic.Settings.Advanced.Network.EnableLowLatencyMode="Low latency mode"
# advanced audio properties
Basic.AdvAudio="Advanced Audio Properties"

View file

@ -3455,9 +3455,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>593</width>
<height>699</height>
<y>-16</y>
<width>803</width>
<height>738</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@ -3787,16 +3787,9 @@
<string>Basic.Settings.Advanced.StreamDelay</string>
</property>
<layout class="QFormLayout" name="formLayout_18">
<item row="0" column="1">
<widget class="QCheckBox" name="streamDelayEnable">
<property name="text">
<string>Enable</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<property name="topMargin">
<number>2</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_56">
<property name="text">
@ -3873,6 +3866,16 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="streamDelayEnable">
<property name="text">
<string>Enable</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -3979,6 +3982,23 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="enableNewSocketLoop">
<property name="text">
<string>Basic.Settings.Advanced.Network.EnableNewSocketLoop</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="enableLowLatencyMode">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Basic.Settings.Advanced.Network.EnableLowLatencyMode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -4147,6 +4167,29 @@
<tabstop>reconnectRetryDelay</tabstop>
<tabstop>reconnectMaxRetries</tabstop>
<tabstop>bindToIP</tabstop>
<tabstop>enableNewSocketLoop</tabstop>
<tabstop>enableLowLatencyMode</tabstop>
<tabstop>warnBeforeStreamStop</tabstop>
<tabstop>recordWhenStreaming</tabstop>
<tabstop>keepRecordStreamStops</tabstop>
<tabstop>replayWhileStreaming</tabstop>
<tabstop>keepReplayStreamStops</tabstop>
<tabstop>snappingEnabled</tabstop>
<tabstop>screenSnapping</tabstop>
<tabstop>centerSnapping</tabstop>
<tabstop>sourceSnapping</tabstop>
<tabstop>snapDistance</tabstop>
<tabstop>hideProjectorCursor</tabstop>
<tabstop>projectorAlwaysOnTop</tabstop>
<tabstop>saveProjectors</tabstop>
<tabstop>systemTrayEnabled</tabstop>
<tabstop>systemTrayWhenStarted</tabstop>
<tabstop>systemTrayAlways</tabstop>
<tabstop>enableAutoUpdates</tabstop>
<tabstop>warnBeforeStreamStart</tabstop>
<tabstop>scrollArea_2</tabstop>
<tabstop>language</tabstop>
<tabstop>theme</tabstop>
</tabstops>
<resources>
<include location="obs.qrc"/>
@ -4276,7 +4319,7 @@
</hint>
<hint type="destinationlabel">
<x>241</x>
<y>54</y>
<y>53</y>
</hint>
</hints>
</connection>
@ -4291,7 +4334,7 @@
<y>67</y>
</hint>
<hint type="destinationlabel">
<x>243</x>
<x>250</x>
<y>67</y>
</hint>
</hints>
@ -4344,54 +4387,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>label_56</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>503</x>
<y>450</y>
</hint>
<hint type="destinationlabel">
<x>269</x>
<y>476</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>streamDelayPreserve</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>503</x>
<y>450</y>
</hint>
<hint type="destinationlabel">
<x>503</x>
<y>499</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>widget_12</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>503</x>
<y>450</y>
</hint>
<hint type="destinationlabel">
<x>503</x>
<y>476</y>
</hint>
</hints>
</connection>
<connection>
<sender>simpleOutAdvanced</sender>
<signal>toggled(bool)</signal>
@ -4415,12 +4410,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>384</x>
<y>559</y>
<x>730</x>
<y>556</y>
</hint>
<hint type="destinationlabel">
<x>400</x>
<y>585</y>
<x>746</x>
<y>579</y>
</hint>
</hints>
</connection>
@ -4431,12 +4426,28 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>484</x>
<y>566</y>
<x>830</x>
<y>556</y>
</hint>
<hint type="destinationlabel">
<x>480</x>
<y>605</y>
<x>826</x>
<y>602</y>
</hint>
</hints>
</connection>
<connection>
<sender>enableNewSocketLoop</sender>
<signal>toggled(bool)</signal>
<receiver>enableLowLatencyMode</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>403</x>
<y>642</y>
</hint>
<hint type="destinationlabel">
<x>403</x>
<y>665</y>
</hint>
</hints>
</connection>
@ -4447,12 +4458,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>380</x>
<y>322</y>
<x>733</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>330</x>
<y>350</y>
<x>347</x>
<y>343</y>
</hint>
</hints>
</connection>
@ -4463,12 +4474,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>421</x>
<y>325</y>
<x>774</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>429</x>
<y>346</y>
<x>782</x>
<y>343</y>
</hint>
</hints>
</connection>
@ -4479,12 +4490,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>467</x>
<y>325</y>
<x>820</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>484</x>
<y>378</y>
<x>837</x>
<y>366</y>
</hint>
</hints>
</connection>
@ -4495,12 +4506,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>528</x>
<y>329</y>
<x>881</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>537</x>
<y>392</y>
<x>890</x>
<y>389</y>
</hint>
</hints>
</connection>
@ -4511,12 +4522,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>575</x>
<y>328</y>
<x>928</x>
<y>317</y>
</hint>
<hint type="destinationlabel">
<x>562</x>
<y>422</y>
<x>915</x>
<y>412</y>
</hint>
</hints>
</connection>
@ -4527,12 +4538,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>457</x>
<y>205</y>
<x>803</x>
<y>199</y>
</hint>
<hint type="destinationlabel">
<x>474</x>
<y>226</y>
<x>820</x>
<y>222</y>
</hint>
</hints>
</connection>
@ -4543,12 +4554,76 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>401</x>
<y>247</y>
<x>747</x>
<y>245</y>
</hint>
<hint type="destinationlabel">
<x>407</x>
<y>270</y>
<x>753</x>
<y>268</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>label_56</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>431</x>
<y>422</y>
</hint>
<hint type="destinationlabel">
<x>356</x>
<y>443</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>streamDelaySec</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>465</x>
<y>420</y>
</hint>
<hint type="destinationlabel">
<x>463</x>
<y>447</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>streamDelayInfo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>533</x>
<y>420</y>
</hint>
<hint type="destinationlabel">
<x>557</x>
<y>446</y>
</hint>
</hints>
</connection>
<connection>
<sender>streamDelayEnable</sender>
<signal>toggled(bool)</signal>
<receiver>streamDelayPreserve</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>504</x>
<y>420</y>
</hint>
<hint type="destinationlabel">
<x>494</x>
<y>465</y>
</hint>
</hints>
</connection>

View file

@ -665,9 +665,17 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
"DelayPreserve");
const char *bindIP = config_get_string(main->Config(), "Output",
"BindIP");
bool enableNewSocketLoop = config_get_bool(main->Config(), "Output",
"NewSocketLoopEnable");
bool enableLowLatencyMode = config_get_bool(main->Config(), "Output",
"LowLatencyEnable");
obs_data_t *settings = obs_data_create();
obs_data_set_string(settings, "bind_ip", bindIP);
obs_data_set_bool(settings, "new_socket_loop_enabled",
enableNewSocketLoop);
obs_data_set_bool(settings, "low_latency_mode_enabled",
enableLowLatencyMode);
obs_output_update(streamOutput, settings);
obs_data_release(settings);
@ -1314,9 +1322,17 @@ bool AdvancedOutput::StartStreaming(obs_service_t *service)
"DelayPreserve");
const char *bindIP = config_get_string(main->Config(), "Output",
"BindIP");
bool enableNewSocketLoop = config_get_bool(main->Config(), "Output",
"NewSocketLoopEnable");
bool enableLowLatencyMode = config_get_bool(main->Config(), "Output",
"LowLatencyEnable");
obs_data_t *settings = obs_data_create();
obs_data_set_string(settings, "bind_ip", bindIP);
obs_data_set_bool(settings, "new_socket_loop_enabled",
enableNewSocketLoop);
obs_data_set_bool(settings, "low_latency_mode_enabled",
enableLowLatencyMode);
obs_output_update(streamOutput, settings);
obs_data_release(settings);

View file

@ -1001,6 +1001,10 @@ bool OBSBasic::InitBasicConfigDefaults()
config_set_default_uint (basicConfig, "Output", "MaxRetries", 20);
config_set_default_string(basicConfig, "Output", "BindIP", "default");
config_set_default_bool (basicConfig, "Output", "NewSocketLoopEnable",
false);
config_set_default_bool (basicConfig, "Output", "LowLatencyEnable",
false);
int i = 0;
uint32_t scale_cx = cx;

View file

@ -403,6 +403,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->reconnectMaxRetries, SCROLL_CHANGED, ADV_CHANGED);
HookWidget(ui->processPriority, COMBO_CHANGED, ADV_CHANGED);
HookWidget(ui->bindToIP, COMBO_CHANGED, ADV_CHANGED);
HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED);
HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED);
#if !defined(_WIN32) && !defined(__APPLE__)
delete ui->monitoringDevice;
@ -453,6 +455,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
delete ui->processPriorityLabel;
delete ui->processPriority;
delete ui->advancedGeneralGroupBox;
delete ui->enableNewSocketLoop;
delete ui->enableLowLatencyMode;
ui->rendererLabel = nullptr;
ui->renderer = nullptr;
ui->adapterLabel = nullptr;
@ -460,6 +464,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
ui->processPriorityLabel = nullptr;
ui->processPriority = nullptr;
ui->advancedGeneralGroupBox = nullptr;
ui->enableNewSocketLoop = nullptr;
ui->enableLowLatencyMode = nullptr;
#endif
#ifndef __APPLE__
@ -2004,6 +2010,7 @@ void OBSBasicSettings::LoadAdvancedSettings()
ui->streamDelayPreserve->setChecked(preserveDelay);
ui->streamDelayEnable->setChecked(enableDelay);
SetComboByName(ui->colorFormat, videoColorFormat);
SetComboByName(ui->colorSpace, videoColorSpace);
SetComboByValue(ui->colorRange, videoColorRange);
@ -2025,10 +2032,18 @@ void OBSBasicSettings::LoadAdvancedSettings()
#elif _WIN32
const char *processPriority = config_get_string(App()->GlobalConfig(),
"General", "ProcessPriority");
bool enableNewSocketLoop = config_get_bool(main->Config(), "Output",
"NewSocketLoopEnable");
bool enableLowLatencyMode = config_get_bool(main->Config(), "Output",
"LowLatencyEnable");
idx = ui->processPriority->findData(processPriority);
if (idx == -1)
idx = ui->processPriority->findData("Normal");
ui->processPriority->setCurrentIndex(idx);
ui->enableNewSocketLoop->setChecked(enableNewSocketLoop);
ui->enableLowLatencyMode->setChecked(enableLowLatencyMode);
#endif
loading = false;
@ -2505,6 +2520,9 @@ void OBSBasicSettings::SaveAdvancedSettings()
priority.c_str());
if (main->Active())
SetProcessPriority(priority.c_str());
SaveCheckBox(ui->enableNewSocketLoop, "Output", "NewSocketLoopEnable");
SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable");
#endif
#ifdef __APPLE__