Skip to content
Open
Changes from all commits
Commits
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/platform/linux/x11grab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ namespace platf {
}

screen_res_t screenr {x11::rr::GetScreenResources(xdisplay.get(), xwindow)};
if (!screenr) {
BOOST_LOG(error) << "Could not query X screen resources"sv;
return -1;
}
int output = screenr->noutput;

output_info_t result;
Expand All @@ -531,8 +535,12 @@ namespace platf {
}
}

crtc_info_t crt_info;
if (result_found && result->crtc) {
crtc_info_t crt_info {x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc)};
crt_info = crtc_info_t {x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc)};
}

if (crt_info) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] A transient null XRRGetCrtcInfo result for a successfully matched, selected monitor now takes the existing whole-desktop branch and returns success. Both X11 capture paths then use xattr.width/height from the root window, so a stream configured for one monitor can show every monitor for the lifetime of that capture object. Please fail initialization for this lookup error (as the screen-resources guard does) so the existing display reset/retry path can recover without changing the captured area.

BOOST_LOG(info)
<< "Streaming display: "sv << result->name << " with res "sv << crt_info->width << 'x' << crt_info->height << " offset by "sv << crt_info->x << 'x' << crt_info->y;

Expand Down Expand Up @@ -942,6 +950,10 @@ namespace platf {

auto xwindow = DefaultRootWindow(xdisplay.get());
screen_res_t screenr {x11::rr::GetScreenResources(xdisplay.get(), xwindow)};
if (!screenr) {
BOOST_LOG(error) << "Could not query X screen resources"sv;
return {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] If XRRGetScreenResources is transiently null during startup, returning an empty list makes verify_x11() false. platf::init() performs that backend probe once and leaves sources[source::X11] unset, so a later healthy RandR state cannot be retried by a stream; Sunshine needs a restart to use X11. Please retry the transient discovery failure or provide a path to re-probe X11 availability.

}
int output = screenr->noutput;

std::vector<std::string> names;
Expand Down