Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

fix: overlay-safe frame generation, FSR4 only on AMD, screen-change crash, Xbox refusal reasons

Veyra Goal Agent3dc00804f736
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 8db635ca..3a4e0564 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -697,6 +697,20 @@ int main(int argc, char** argv) {
// The first frame may come before the page layout settles; one pass after the
// event loop starts covers a scene that then never animates.
QTimer::singleShot(0, &app, follow);
+ // Test only: VEYRA_TEST_DPI_FLIP=<ms> sends the window the WM_DPICHANGED a move to a
+ // 150 % screen would, then back to 100 % three seconds later, so the screen-change
+ // crash (field report 2026-10-01, two monitors) can be reproduced on one monitor.
+ if (const auto flip = qEnvironmentVariableIntValue("VEYRA_TEST_DPI_FLIP"); flip > 0) {
+ const auto send = [window](UINT dpi) {
+ const HWND hwnd = reinterpret_cast<HWND>(window->winId());
+ RECT r{};
+ GetWindowRect(hwnd, &r);
+ veyra::log::info("dpi-test", std::format("WM_DPICHANGED dpi={}", dpi));
+ SendMessageW(hwnd, WM_DPICHANGED, MAKEWPARAM(dpi, dpi), reinterpret_cast<LPARAM>(&r));
+ };
+ QTimer::singleShot(flip, &app, [send] { send(144); });
+ QTimer::singleShot(flip + 3000, &app, [send] { send(96); });
+ }
// Before every open, place the native window and force the pending layout to
// be applied so the client size the presenter reads is the real one.
diff --git a/include/veyra/gfx/PresentSink.h b/include/veyra/gfx/PresentSink.h
index 7007ce54..e0f976b0 100644
--- a/include/veyra/gfx/PresentSink.h
+++ b/include/veyra/gfx/PresentSink.h
@@ -126,6 +126,8 @@ public:
void shutdown();
// False while a failed ResizeBuffers is backing off (see resize()).
bool resizeDue() const;
+ // True when XeSS was requested but an injected overlay made us present natively.
+ bool xessBlockedByHook() const { return xessBlockedByHook_; }
private:
static LRESULT CALLBACK wndProcThunk(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
@@ -154,6 +156,7 @@ private:
uint32_t resizeFailures_ = 0;
uint64_t lastResizeFailureMs_ = 0;
bool xessFailed_ = false;
+ bool xessBlockedByHook_ = false;
ID3D12Device* device_ = nullptr;
ID3D12CommandQueue* queue_ = nullptr;
ComPtr<IDXGIFactory2> factory_;
diff --git a/include/veyra/gfx/PresentationHooks.h b/include/veyra/gfx/PresentationHooks.h
new file mode 100644
index 00000000..426c35ff
--- /dev/null
+++ b/include/veyra/gfx/PresentationHooks.h
@@ -0,0 +1,33 @@
+#pragma once
+// Monitoring overlays that inject into this process and hook presentation.
+//
+// Field crashes 2026-10-01: with RivaTuner Statistics Server (MSI Afterburner's on-screen
+// display, RTSSHooks64.dll) injected, every session that turned XeSS frame generation on
+// crashed inside d3d11.dll a second or two later: RTSS draws its OSD with D3D11On12 into
+// the XeSS proxy swapchain. GamePP (游加加) held swapchain buffers so every resize failed
+// and the driver crashed on a window change. The same tools are fine with the ordinary
+// DXGI swapchain and with DLSS frame generation.
+#include <windows.h>
+
+namespace veyra::gfx {
+
+struct PresentationHook {
+ const wchar_t* module;
+ const char* product;
+};
+
+inline constexpr PresentationHook kPresentationHooks[] = {
+ {L"RTSSHooks64.dll", "RivaTuner Statistics Server (MSI Afterburner)"},
+ {L"GPP64.dll", "GamePP"},
+ {L"shade64.dll", "GamePP"},
+ {L"GameTracker64.dll", "GamePP"},
+};
+
+// The first injected overlay found, or nullptr.
+inline const PresentationHook* injectedPresentationHook() {
+ for (const auto& hook : kPresentationHooks)
+ if (GetModuleHandleW(hook.module)) return &hook;
+ return nullptr;
+}
+
+} // namespace veyra::gfx
diff --git a/qml/Veyra/CineBar.qml b/qml/Veyra/CineBar.qml
index d8986f90..64ef92f5 100644
--- a/qml/Veyra/CineBar.qml
+++ b/qml/Veyra/CineBar.qml
@@ -68,16 +68,22 @@ Rectangle {
objectName: "cine-cover"
anchors.fill: parent
anchors.margins: 1
- visible: status === Image.Ready
+ // Drawn through the masking effect below, never directly.
+ visible: false
fillMode: Image.PreserveAspectCrop
asynchronous: true
cache: false
source: veyra.hasSource && !veyra.isCapture ? "image://veyra-thumb/cover/" + veyra.thumbnailGeneration : ""
- layer.enabled: visible
- layer.effect: MultiEffect {
- maskEnabled: true
- maskSource: coverMask
- }
+ }
+ // A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
+ // a screen DPI change while it walks the parent's children, and the walk then touched
+ // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
+ MultiEffect {
+ source: coverArt
+ anchors.fill: coverArt
+ visible: coverArt.status === Image.Ready
+ maskEnabled: true
+ maskSource: coverMask
}
Rectangle { id: coverMask; anchors.fill: coverArt; radius: 11; visible: false; layer.enabled: true }
}
diff --git a/qml/Veyra/HomePage.qml b/qml/Veyra/HomePage.qml
index fb2b259a..4fc1d82c 100644
--- a/qml/Veyra/HomePage.qml
+++ b/qml/Veyra/HomePage.qml
@@ -44,8 +44,12 @@ VPage {
sourceSize.width: 128
fillMode: Image.PreserveAspectFit
}
- layer.enabled: true
- layer.effect: MultiEffect {
+ // A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
+ // a screen DPI change while it walks the parent's children, and the walk then touched
+ // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
+ MultiEffect {
+ source: logoImg
+ anchors.fill: logoImg
shadowEnabled: true
shadowColor: "#FFFFFF"
shadowHorizontalOffset: 0
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index 1deef2d2..aa2c9d28 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -268,15 +268,27 @@ VPage {
readonly property color tone: veyra.runStatusLevel === "ok" ? Theme.ok
: veyra.runStatusLevel === "warn" ? "#F2B941"
: veyra.runStatusLevel === "err" ? Theme.err : Qt.rgba(1, 1, 1, 0.3)
- Rectangle {
+ Item {
Layout.fillWidth: true
Layout.preferredHeight: 4
- radius: 2
- color: light.tone
- opacity: veyra.runStatusLevel === "idle" ? 0.35 : 0.9
- Behavior on color { ColorAnimation { duration: Theme.d(300) } }
- layer.enabled: veyra.runStatusLevel !== "idle"
- layer.effect: MultiEffect { shadowEnabled: true; shadowColor: light.tone; shadowBlur: 0.6; shadowVerticalOffset: 0; blurMax: 12; autoPaddingEnabled: true }
+ Rectangle {
+ id: strip
+ anchors.fill: parent
+ radius: 2
+ color: light.tone
+ opacity: veyra.runStatusLevel === "idle" ? 0.35 : 0.9
+ Behavior on color { ColorAnimation { duration: Theme.d(300) } }
+ }
+ // A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
+ // a screen DPI change while it walks the parent's children, and the walk then touched
+ // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
+ MultiEffect {
+ source: strip
+ anchors.fill: strip
+ visible: veyra.runStatusLevel !== "idle"
+ opacity: strip.opacity
+ shadowEnabled: true; shadowColor: light.tone; shadowBlur: 0.6; shadowVerticalOffset: 0; blurMax: 12; autoPaddingEnabled: true
+ }
}
Text {
text: veyra.runStatus + (veyra.runStatusDetail.length > 0 ? " · " + veyra.runStatusDetail : "")
diff --git a/qml/Veyra/VSlider.qml b/qml/Veyra/VSlider.qml
index cfccea88..1838f903 100644
--- a/qml/Veyra/VSlider.qml
+++ b/qml/Veyra/VSlider.qml
@@ -69,16 +69,20 @@ Item {
x: track.width * slider.frac - width / 2
scale: drag.active || hover.hovered ? 1.25 : 1.0
Behavior on scale { NumberAnimation { duration: Theme.d(350); easing.bezierCurve: Theme.spring } }
- // box-shadow: 0 2px 6px rgba(0,0,0,.5)
- layer.enabled: true
- layer.effect: MultiEffect {
- shadowEnabled: true
- shadowColor: Qt.rgba(0, 0, 0, 0.5)
- shadowVerticalOffset: 2
- shadowBlur: 0.5
- blurMax: 12
- autoPaddingEnabled: true
- }
+ }
+ // box-shadow: 0 2px 6px rgba(0,0,0,.5). A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
+ // a screen DPI change while it walks the parent's children, and the walk then touched
+ // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
+ MultiEffect {
+ source: knob
+ anchors.fill: knob
+ scale: knob.scale
+ shadowEnabled: true
+ shadowColor: Qt.rgba(0, 0, 0, 0.5)
+ shadowVerticalOffset: 2
+ shadowBlur: 0.5
+ blurMax: 12
+ autoPaddingEnabled: true
}
Item {
id: trackInput
diff --git a/scripts/ui-check/dpi-flip.qml b/scripts/ui-check/dpi-flip.qml
new file mode 100644
index 00000000..d79fecfa
--- /dev/null
+++ b/scripts/ui-check/dpi-flip.qml
@@ -0,0 +1,16 @@
+
+ // ---- screen DPI change with a video open (run with VEYRA_TEST_DPI_FLIP=8000) ----------
+ // Field report 2026-10-01: moving the window to a second monitor with a video open
+ // crashed in QQuickItem::childItems. The app must survive both DPI changes.
+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }
+ Timer {
+ interval: 250; running: true; repeat: true
+ property int ticks: 0
+ onTriggered: {
+ ++ticks
+ if (ticks === 6) veyra.openUrl("@VIDEO@")
+ if (ticks === 14) root.goPage("pro")
+ if (ticks === 40) veyra.logUi("uitest", "UITEST_SHOT after-dpi-150")
+ if (ticks === 56) { veyra.logUi("uitest", "UITEST_NOTE running=" + veyra.running + " page=" + root.page); veyra.logUi("uitest", "UITEST_DONE"); running = false }
+ }
+ }
diff --git a/src/gfx/PresentSink.cpp b/src/gfx/PresentSink.cpp
index 9db80830..80fea925 100644
--- a/src/gfx/PresentSink.cpp
+++ b/src/gfx/PresentSink.cpp
@@ -1,4 +1,5 @@
#include "veyra/gfx/PresentSink.h"
+#include "veyra/gfx/PresentationHooks.h"
#include <windows.h>
#include <d3d12sdklayers.h>
@@ -197,6 +198,13 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,
}
for(auto& b:backBuffers_)b.Reset();
swapChain_.Reset();
+ // An injected overlay draws into the XeSS proxy swapchain and crashes the process
+ // (PresentationHooks.h); present natively instead, as for any XeSS failure.
+ if(const auto* hook=injectedPresentationHook()){
+ log::warn("present",std::format("XeSS FG not started: {} is injected and crashes the XeSS swapchain; native presentation",hook->product));
+ xessBlockedByHook_=true;
+ }else{
+ xessBlockedByHook_=false;
xess_=std::make_unique<XessPresenter>();
if(!xess_->initialize(device,queue,factory_.Get(),hwnd_,scd,swapChain_.GetAddressOf(),desc.fgMultiplier,desc.xessLowLatencySleep)){
// XeSS is an optional experimental presenter. A missing or
@@ -205,6 +213,7 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,
swapChain_.Reset();
xess_.reset();
}
+ }
}
if (!swapChain_) {
const auto createNative=[&](){
diff --git a/src/source/XboxSessionSource.cpp b/src/source/XboxSessionSource.cpp
index 916ddb2a..bcf256c2 100644
--- a/src/source/XboxSessionSource.cpp
+++ b/src/source/XboxSessionSource.cpp
@@ -246,7 +246,12 @@ void XboxSessionSource::run(XboxConnectDesc desc) {
const xbox::SessionState state = p.api->state(p.sessionId);
log::info("xbox", "session state " + state.state);
if (state.state == "Provisioned") break;
- if (state.state == "Failed") { fail(describeSessionFailure(state.errorCode, state.errorMessage)); return; }
+ if (state.state == "Failed") {
+ log::error("xbox", "session failed code=" + (state.errorCode.empty() ? std::string("?") : state.errorCode) +
+ " message=" + (state.errorMessage.empty() ? std::string("?") : state.errorMessage));
+ fail(describeSessionFailure(state.errorCode, state.errorMessage));
+ return;
+ }
if (state.state == "ReadyToConnect" && !connectSent) {
p.api->connect(p.sessionId, p.desc.account->transferToken());
connectSent = true;
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index d112d9e8..fe935955 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -86,6 +86,9 @@ namespace Gdiplus { using std::min; using std::max; }
#include "veyra/ui/PlaybackPowerGuard.h"
#include "veyra/gfx/XessMfgUnlock.h"
#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/gfx/PresentationHooks.h"
+#include <dxgi1_4.h>
+#include <wrl/client.h>
#include "veyra/ngx/NrArchitecturePolicy.h"
#include "veyra/source/CaptureCardSource.h"
#include "veyra/source/ScreenCaptureSource.h"
@@ -628,6 +631,30 @@ bool prepareStartupPreset(const engine::PresetEntry& entry, engine::ChainSession
}
} // namespace
+// The first hardware adapter, the one the engine opens (gfx adapter[0]): 0x10DE NVIDIA,
+// 0x1002 AMD, 0x8086 Intel, 0 unknown.
+static uint32_t primaryGpuVendor() {
+ static const uint32_t vendor = [] {
+ Microsoft::WRL::ComPtr<IDXGIFactory1> factory;
+ if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 0u;
+ Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
+ for (UINT i = 0; factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; ++i, adapter.Reset()) {
+ DXGI_ADAPTER_DESC1 desc{};
+ if (FAILED(adapter->GetDesc1(&desc)) || (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)) continue;
+ return unsigned(desc.VendorId);
+ }
+ return 0u;
+ }();
+ return vendor;
+}
+// FSR 4 ML frame generation needs an AMD RX 9000; on other GPUs the provider crashed the
+// whole program (field report 2026-10-01). Known non-AMD adapters are refused up front.
+static bool fsr4Possible() { const auto v = primaryGpuVendor(); return v == 0 || v == 0x1002; }
+// What replaces XeSS FG while an overlay that crashes its proxy swapchain is injected.
+static engine::FrameGenerationBackend hookSafeBackend() {
+ return primaryGpuVendor() == 0x10DE ? engine::FrameGenerationBackend::Dlss : engine::FrameGenerationBackend::Fsr;
+}
+
QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystem::path dataDirectory,
QObject* parent)
: QObject(parent), impl_(std::make_unique<Impl>(engine, std::move(dataDirectory))) {
@@ -836,34 +863,49 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
impl_->timer->start(16);
startGpuSampler();
// Overlays that hook presentation get injected into this process when a D3D device
- // appears (Qt's at start, the engine's at open). Field log 2026-10-01: with GamePP's
- // modules loaded, both the video swapchain and Qt's own failed every resize, a
- // settings rebuild could not recreate the swapchain, and the driver crashed on a
- // window change. Look for them for two minutes and say so once.
+ // appears (Qt's at start, the engine's at open); see gfx/PresentationHooks.h for what
+ // they broke in the field. Look for them for two minutes, say so once, and move a
+ // saved XeSS frame generation (which they crash) to DLSS or FSR.
auto* hookTimer = new QTimer(this);
connect(hookTimer, &QTimer::timeout, this, [this, hookTimer, started = GetTickCount64()] {
- struct Hook { const wchar_t* module; const char* product; bool warn; };
- static const Hook hooks[] = {
- {L"GPP64.dll", "GamePP", true}, {L"shade64.dll", "GamePP", true}, {L"GameTracker64.dll", "GamePP", true},
- {L"RTSSHooks64.dll", "RivaTuner Statistics Server", false}, {L"graphics-hook64.dll", "OBS game capture", false},
- {L"DiscordHook64.dll", "Discord overlay", false}, {L"gameoverlayrenderer64.dll", "Steam overlay", false},
+ struct Seen { const wchar_t* module; const char* product; };
+ static const Seen others[] = {
+ {L"graphics-hook64.dll", "OBS game capture"}, {L"DiscordHook64.dll", "Discord overlay"},
+ {L"gameoverlayrenderer64.dll", "Steam overlay"},
};
- static bool seen[std::size(hooks)]{};
- static bool warned = false;
- for (size_t k = 0; k < std::size(hooks); ++k) {
- if (seen[k] || !GetModuleHandleW(hooks[k].module)) continue;
- seen[k] = true;
- veyra::log::warn("overlay-hooks", std::format("{} is injected into this process ({}); it hooks presentation and can "
- "hold swapchain buffers", hooks[k].product, QString::fromWCharArray(hooks[k].module).toStdString()));
- if (hooks[k].warn && !warned) {
- warned = true;
- emit notice(tr("检测到游加加(GamePP)注入了本程序。它会钩住画面输出,可能导致改窗口大小、全屏、改设置时画面异常或崩溃。"
- "请在游加加里关闭对 Veyra 的帧数显示 / 滤镜,或退出游加加后再用。"), true);
+ static bool loggedOthers[std::size(others)]{};
+ for (size_t k = 0; k < std::size(others); ++k)
+ if (!loggedOthers[k] && GetModuleHandleW(others[k].module)) {
+ loggedOthers[k] = true;
+ veyra::log::info("overlay-hooks", std::format("{} is injected into this process", others[k].product));
+ }
+ static bool handled = false;
+ if (const auto* hook = gfx::injectedPresentationHook(); hook && !handled) {
+ handled = true;
+ veyra::log::warn("overlay-hooks", std::format("{} is injected into this process ({}); XeSS frame generation is "
+ "kept off while it is present", hook->product, QString::fromWCharArray(hook->module).toStdString()));
+ auto s = settings();
+ if (s.frameGenerationBackend == engine::FrameGenerationBackend::XeSS) {
+ s.frameGenerationBackend = hookSafeBackend();
+ if (impl_->chain.fgMultiplier > 2 && engine::fsrFrameGeneration(s.frameGenerationBackend)) impl_->chain.fgMultiplier = 2;
+ if (impl_->commit(s)) { emit settingsChanged(); emit chainChanged(); }
+ emit notice(tr("检测到 %1 注入了本程序,它和 XeSS 补帧一起用会闪退,补帧已自动改用 %2。关掉它的帧数显示后可以换回 XeSS")
+ .arg(QString::fromUtf8(hook->product),
+ s.frameGenerationBackend == engine::FrameGenerationBackend::Dlss ? tr("DLSS") : tr("FSR 3.1")), true);
+ } else {
+ emit notice(tr("检测到 %1 注入了本程序。它和 XeSS 补帧不兼容;如果改窗口大小、全屏或改设置时画面异常,请关掉它的帧数显示或滤镜")
+ .arg(QString::fromUtf8(hook->product)), false);
}
}
if (GetTickCount64() - started > 120000) hookTimer->stop();
});
- hookTimer->start(5000);
+ hookTimer->start(2000);
+ // A saved FSR 4 ML choice on a non-AMD GPU crashed at the first open; move it on.
+ if (settings().frameGenerationBackend == engine::FrameGenerationBackend::Fsr4 && !fsr4Possible()) {
+ auto s = settings();
+ s.frameGenerationBackend = primaryGpuVendor() == 0x10DE ? engine::FrameGenerationBackend::Dlss : engine::FrameGenerationBackend::Fsr;
+ if (impl_->commit(s)) veyra::log::warn("fg-backend", "saved FSR 4 ML frame generation needs an AMD RX 9000; switched for this GPU");
+ }
}
QmlPlayerBridge::~QmlPlayerBridge() {
@@ -1121,6 +1163,20 @@ void QmlPlayerBridge::setFgBackendName(const QString& value) {
: value == QLatin1String("fsr4") ? engine::FrameGenerationBackend::Fsr4
: engine::FrameGenerationBackend::Dlss;
if (s.frameGenerationBackend == want) return;
+ if (want == engine::FrameGenerationBackend::Fsr4 && !fsr4Possible()) {
+ // Keep the previous choice; the menu snaps back to it.
+ emit notice(tr("FSR 4 ML 补帧只支持 AMD RX 9000 显卡,当前显卡不能使用,已保持原来的补帧方式"), true);
+ emit settingsChanged();
+ return;
+ }
+ if (want == engine::FrameGenerationBackend::XeSS) {
+ if (const auto* hook = gfx::injectedPresentationHook()) {
+ emit notice(tr("检测到 %1 正在注入本程序,它和 XeSS 补帧一起用会导致闪退,已保持原来的补帧方式。"
+ "关掉它的帧数显示后可以用 XeSS;不关也可以用 DLSS 或 FSR 补帧").arg(QString::fromUtf8(hook->product)), true);
+ emit settingsChanged();
+ return;
+ }
+ }
s.frameGenerationBackend = want;
// A DLSS multiplier above XeSS's ceiling used to make the switch fail
// silently in effect (the backend stayed DLSS). Clamp to the ceiling instead.
diff --git a/src/xbox/StreamApi.cpp b/src/xbox/StreamApi.cpp
index b8b101ee..7c7b7858 100644
--- a/src/xbox/StreamApi.cpp
+++ b/src/xbox/StreamApi.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "veyra/xbox/StreamApi.h"
+#include "veyra/Log.h"
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -134,14 +135,32 @@ std::string StreamApi::exchangeSdp(const std::string& sessionId, const std::stri
const std::string path = "/v5/sessions/home/" + sessionId + "/sdp";
call("POST", path, body.dump());
const std::string exchange = getExchange(path);
+ json answer;
try {
- const json answer = json::parse(exchange);
- const std::string sdp = answer.value("sdp", "");
- if (sdp.empty()) throw std::runtime_error("the console's answer has no SDP (status: " + answer.value("status", std::string("?")) + ")");
- return sdp;
+ answer = json::parse(exchange);
} catch (const json::exception&) {
throw std::runtime_error("the console's answer is not JSON");
}
+ // A refusal comes back with "sdp": null plus a status and error details (field log
+ // 2026-10-01: value("sdp") threw on the null and hid the reason). Log the whole answer
+ // without the SDP body; it carries no credentials.
+ const auto text = [&](const char* key) {
+ return answer.contains(key) && answer[key].is_string() ? answer[key].get<std::string>() : std::string();
+ };
+ const std::string sdp = text("sdp");
+ if (sdp.empty()) {
+ json summary = answer;
+ summary.erase("sdp");
+ log::warn("xbox", "console SDP answer without SDP: " + summary.dump());
+ std::string why = text("status");
+ if (answer.contains("errorDetails") && answer["errorDetails"].is_object()) {
+ const json& e = answer["errorDetails"];
+ for (const char* key : {"code", "message"})
+ if (e.contains(key) && e[key].is_string()) why += std::string(why.empty() ? "" : " / ") + e[key].get<std::string>();
+ }
+ throw std::runtime_error("the console refused the offer (" + (why.empty() ? std::string("no reason given") : why) + ")");
+ }
+ return sdp;
}
bool StreamApi::teredoIpv4(const std::string& ipv6, std::string* ipv4, int* port) {