Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,16 +1341,28 @@ namespace confighttp {
nlohmann::json input_tree = nlohmann::json::parse(ss);
const std::string name = input_tree.value("name", "");
const std::string pin = input_tree.value("pin", "");
BOOST_LOG(info) << "PAIR_DIAG /api/pin API handler received name="sv << (name.empty() ? "<empty>"s : name)
<< " missing_name="sv << name.empty()
<< " pin_len="sv << pin.size()
<< " web_client_id="sv << client_id;

int _pin = 0;
_pin = std::stoi(pin);
if (_pin < 0 || _pin > 9999) {
BOOST_LOG(warning) << "PAIR_DIAG /api/pin API handler rejected reason=pin outside 0000-9999 pin_len="sv << pin.size();
bad_request(response, request, "PIN must be between 0000 and 9999");
}

output_tree["status"] = nvhttp::pin(pin, name);
const auto pin_status = nvhttp::pin(pin, name);
if (pin_status) {
BOOST_LOG(info) << "PAIR_DIAG /api/pin API handler completed status=true name="sv << (name.empty() ? "<empty>"s : name);
} else {
BOOST_LOG(warning) << "PAIR_DIAG /api/pin API handler completed status=false name="sv << (name.empty() ? "<empty>"s : name);
}
output_tree["status"] = pin_status;
send_response(response, output_tree);
} catch (std::exception &e) {
BOOST_LOG(error) << "PAIR_DIAG exception in /api/pin API handler: "sv << e.what();
BOOST_LOG(warning) << "SavePin: "sv << e.what();
bad_request(response, request, e.what());
}
Expand Down
21 changes: 21 additions & 0 deletions src/nvenc/nvenc_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,27 @@

init_params.encodeConfig = &enc_config;

// Diagnostic snapshot of the colour configuration the NVENC encoder
// is being initialised with. The Moonlight client overlay reads its
// HDR/SDR badge primarily from Sunshine's control_hdr_mode_t packet,
// but if the bitstream-side colour config doesn't match (BT.2020 +
// SMPTE2084 + limited range for HDR10), some clients fall back to
// SDR rendering even after seeing the control flag. Log the actual
// values so a future regression is immediately visible.
{
auto videoFormat_name = client_config.videoFormat == 0 ? "H.264"sv :
client_config.videoFormat == 1 ? "HEVC"sv :
client_config.videoFormat == 2 ? "AV1"sv :
"?"sv;

Check warning on line 436 in src/nvenc/nvenc_base.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract this nested conditional operator into an independent statement.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AZ4v1KyFg53RRSBHnQJx&open=AZ4v1KyFg53RRSBHnQJx&pullRequest=5096

Check warning on line 436 in src/nvenc/nvenc_base.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract this nested conditional operator into an independent statement.

See more on https://sonarcloud.io/project/issues?id=LizardByte_Sunshine&issues=AZ4v1KyFg53RRSBHnQJy&open=AZ4v1KyFg53RRSBHnQJy&pullRequest=5096
BOOST_LOG(info) << "NvEnc color-config: codec="sv << videoFormat_name
<< " primaries="sv << colorspace.primaries
<< " transfer="sv << colorspace.tranfer_function
<< " matrix="sv << colorspace.matrix
<< " full_range="sv << (int) colorspace.full_range
<< " bit_depth="sv << (buffer_is_10bit() ? "10"sv : "8"sv)
<< " yuv444="sv << (buffer_is_yuv444() ? "yes"sv : "no"sv);
}

if (nvenc_failed(nvenc->nvEncInitializeEncoder(encoder, &init_params))) {
BOOST_LOG(error) << "NvEnc: NvEncInitializeEncoder() failed: " << last_nvenc_error_string;
return false;
Expand Down
521 changes: 433 additions & 88 deletions src/nvhttp.cpp

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/platform/linux/cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,12 @@ namespace cuda {
int convert(platf::img_t &img) override {
auto &descriptor = (egl::img_descriptor_t &) img;

if (descriptor.sequence == 0) {
if (egl::diagnostic_gpu_solid_color_enabled()) {
if (descriptor.sequence > sequence || rgb->tex.size() == 0) {
sequence = descriptor.sequence;
rgb = egl::create_diagnostic_solid_color(img);
}
} else if (descriptor.sequence == 0) {
// For dummy images, use a blank RGB texture instead of importing a DMA-BUF
rgb = egl::create_blank(img);
} else if (descriptor.sequence > sequence) {
Expand Down
Loading