diff --git a/sunshine/platform/linux/wayland.cpp b/sunshine/platform/linux/wayland.cpp index 44be6dc1..35bad4be 100644 --- a/sunshine/platform/linux/wayland.cpp +++ b/sunshine/platform/linux/wayland.cpp @@ -169,9 +169,6 @@ void dmabuf_t::frame( next_frame->sd.height = height; next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low; next_frame->sd.obj_count = obj_count; - - next_frame->close_fds = true; - std::fill_n(next_frame->sd.fds + obj_count, 4 - obj_count, -1); } void dmabuf_t::object( @@ -215,15 +212,10 @@ void dmabuf_t::cancel( } void frame_t::destroy() { - if(!close_fds) { - return; + for(auto x = 0; x < sd.obj_count; ++x) { + close(sd.fds[x]); } - for(auto x = 0; x < 4; ++x) { - if(sd.fds[x] >= 0) { - close(sd.fds[x]); - } - } - close_fds = false; + sd.obj_count = 0; } std::vector> monitors(const char *display_name) { diff --git a/sunshine/platform/linux/wayland.h b/sunshine/platform/linux/wayland.h index bf138a0a..409c3a01 100644 --- a/sunshine/platform/linux/wayland.h +++ b/sunshine/platform/linux/wayland.h @@ -23,8 +23,6 @@ class frame_t { public: egl::surface_descriptor_t sd; - bool close_fds = false; - void destroy(); }; diff --git a/sunshine/platform/linux/wlgrab.cpp b/sunshine/platform/linux/wlgrab.cpp index 2e2320a1..c40ac483 100644 --- a/sunshine/platform/linux/wlgrab.cpp +++ b/sunshine/platform/linux/wlgrab.cpp @@ -260,10 +260,10 @@ public: ++sequence; img->sequence = sequence; - img->sd = current_frame->sd; + img->sd = current_frame->sd; // Prevent dmabuf from closing the file descriptors. - current_frame->close_fds = false; + current_frame->sd.obj_count = 0; return platf::capture_e::ok; }