Bring back Auto toggle HDR without using DD methods but DD options
This commit is contained in:
@@ -515,7 +515,7 @@ namespace config {
|
|||||||
}, // display_device
|
}, // display_device
|
||||||
|
|
||||||
1, // min_fps_factor
|
1, // min_fps_factor
|
||||||
0 // max_bitrate
|
0, // max_bitrate
|
||||||
|
|
||||||
"1920x1080x60", // fallback_mode
|
"1920x1080x60", // fallback_mode
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -445,34 +445,42 @@ namespace proc {
|
|||||||
retryInterval *= 2;
|
retryInterval *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retryInterval = 200ms;
|
||||||
|
while (this->display_name.empty()) {
|
||||||
|
if (retryInterval > 2s) {
|
||||||
|
BOOST_LOG(warning) << "Not getting current display in time! HDR will not be toggled.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::this_thread::sleep_for(retryInterval);
|
||||||
|
retryInterval *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
// We should have got the actual streaming display by now
|
// We should have got the actual streaming display by now
|
||||||
std::string currentDisplay = this->display_name;
|
std::string currentDisplay = this->display_name;
|
||||||
if (currentDisplay.empty()) {
|
auto currentDisplayW = platf::from_utf8(currentDisplay).c_str();
|
||||||
BOOST_LOG(warning) << "Not getting current display in time! HDR will not be toggled.";
|
|
||||||
} else {
|
|
||||||
auto currentDisplayW = platf::from_utf8(currentDisplay).c_str();
|
|
||||||
|
|
||||||
bool initial_hdr = VDISPLAY::getDisplayHDRByName(currentDisplayW);
|
initial_hdr = VDISPLAY::getDisplayHDRByName(currentDisplayW);
|
||||||
|
|
||||||
if (config::video.dd.hdr_option == config::video_t::dd_t::hdr_option_e::automatic) {
|
if (config::video.dd.hdr_option == config::video_t::dd_t::hdr_option_e::automatic) {
|
||||||
if (!VDISPLAY::setDisplayHDRByName(currentDisplayW, false)) {
|
mode_changed_display = currentDisplay;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enable_hdr) {
|
if (!VDISPLAY::setDisplayHDRByName(currentDisplayW, false)) {
|
||||||
if (VDISPLAY::setDisplayHDRByName(currentDisplayW, true)) {
|
return;
|
||||||
BOOST_LOG(info) << "HDR enabled for display " << currentDisplay;
|
}
|
||||||
} else {
|
|
||||||
BOOST_LOG(info) << "HDR enable failed for display " << currentDisplay;
|
if (enable_hdr) {
|
||||||
}
|
if (VDISPLAY::setDisplayHDRByName(currentDisplayW, true)) {
|
||||||
}
|
BOOST_LOG(info) << "HDR enabled for display " << currentDisplay;
|
||||||
} else if (initial_hdr) {
|
|
||||||
if (VDISPLAY::setDisplayHDRByName(currentDisplayW, false) && VDISPLAY::setDisplayHDRByName(currentDisplayW, true)) {
|
|
||||||
BOOST_LOG(info) << "HDR toggled successfully for display " << currentDisplay;
|
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG(info) << "HDR toggle failed for display " << currentDisplay;
|
BOOST_LOG(info) << "HDR enable failed for display " << currentDisplay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (initial_hdr) {
|
||||||
|
if (VDISPLAY::setDisplayHDRByName(currentDisplayW, false) && VDISPLAY::setDisplayHDRByName(currentDisplayW, true)) {
|
||||||
|
BOOST_LOG(info) << "HDR toggled successfully for display " << currentDisplay;
|
||||||
|
} else {
|
||||||
|
BOOST_LOG(info) << "HDR toggle failed for display " << currentDisplay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -570,6 +578,16 @@ namespace proc {
|
|||||||
bool has_run = _app_id > 0;
|
bool has_run = _app_id > 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
// Revert HDR state
|
||||||
|
if (has_run && !mode_changed_display.empty()) {
|
||||||
|
auto displayNameW = platf::from_utf8(mode_changed_display);
|
||||||
|
if (VDISPLAY::setDisplayHDRByName(displayNameW.c_str(), initial_hdr)) {
|
||||||
|
BOOST_LOG(info) << "HDR reverted for display " << mode_changed_display;
|
||||||
|
} else {
|
||||||
|
BOOST_LOG(info) << "HDR revert failed for display " << mode_changed_display;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool used_virtual_display = vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK && _launch_session && this->virtual_display;
|
bool used_virtual_display = vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK && _launch_session && this->virtual_display;
|
||||||
if (used_virtual_display) {
|
if (used_virtual_display) {
|
||||||
if (VDISPLAY::removeVirtualDisplay(_launch_session->display_guid)) {
|
if (VDISPLAY::removeVirtualDisplay(_launch_session->display_guid)) {
|
||||||
@@ -599,8 +617,8 @@ namespace proc {
|
|||||||
|
|
||||||
// Load the configured output_name first
|
// Load the configured output_name first
|
||||||
// to prevent the value being write to empty when the initial terminate happens
|
// to prevent the value being write to empty when the initial terminate happens
|
||||||
if (!has_run && proc.initial_display.empty()) {
|
if (!has_run && initial_display.empty()) {
|
||||||
proc.initial_display = config::video.output_name;
|
initial_display = config::video.output_name;
|
||||||
} else {
|
} else {
|
||||||
// Restore output name to its original value
|
// Restore output name to its original value
|
||||||
config::video.output_name = initial_display;
|
config::video.output_name = initial_display;
|
||||||
@@ -611,6 +629,7 @@ namespace proc {
|
|||||||
_app = {};
|
_app = {};
|
||||||
display_name.clear();
|
display_name.clear();
|
||||||
initial_display.clear();
|
initial_display.clear();
|
||||||
|
mode_changed_display.clear();
|
||||||
_launch_session.reset();
|
_launch_session.reset();
|
||||||
virtual_display = false;
|
virtual_display = false;
|
||||||
allow_client_commands = false;
|
allow_client_commands = false;
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ namespace proc {
|
|||||||
|
|
||||||
std::string display_name;
|
std::string display_name;
|
||||||
std::string initial_display;
|
std::string initial_display;
|
||||||
|
std::string mode_changed_display;
|
||||||
|
bool initial_hdr;
|
||||||
bool virtual_display;
|
bool virtual_display;
|
||||||
bool allow_client_commands;
|
bool allow_client_commands;
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ function addRemappingEntry() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- HDR option -->
|
<!-- HDR option -->
|
||||||
<div class="mb-3" v-if="config.dd_configuration_option !== 'disabled'">
|
<div class="mb-3">
|
||||||
<label for="dd_hdr_option" class="form-label">
|
<label for="dd_hdr_option" class="form-label">
|
||||||
{{ $t('config.dd_hdr_option') }}
|
{{ $t('config.dd_hdr_option') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -135,11 +135,12 @@ function addRemappingEntry() {
|
|||||||
<option value="auto">{{ $t('config.dd_hdr_option_auto') }}</option>
|
<option value="auto">{{ $t('config.dd_hdr_option_auto') }}</option>
|
||||||
</select>
|
</select>
|
||||||
<!-- HDR toggle -->
|
<!-- HDR toggle -->
|
||||||
<Checkbox id="dd_wa_hdr_toggle"
|
<!-- <Checkbox id="dd_wa_hdr_toggle"
|
||||||
locale-prefix="config"
|
locale-prefix="config"
|
||||||
v-model="config.dd_wa_hdr_toggle"
|
v-model="config.dd_wa_hdr_toggle"
|
||||||
default="false"
|
default="false"
|
||||||
></Checkbox>
|
v-if="config.dd_configuration_option !== 'disabled'"
|
||||||
|
></Checkbox> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Config revert delay -->
|
<!-- Config revert delay -->
|
||||||
|
|||||||
Reference in New Issue
Block a user