mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-18 20:09:54 +00:00
Merge pull request #196 from nowrep/wlsoftware
wlgrab: Fix ram (software encoding) snapshot
This commit is contained in:
commit
a1a4ce1af8
@ -164,11 +164,14 @@ void dmabuf_t::frame(
|
||||
std::uint32_t obj_count) {
|
||||
auto next_frame = get_next_frame();
|
||||
|
||||
next_frame->sd.fourcc = format;
|
||||
next_frame->sd.width = width;
|
||||
next_frame->sd.height = height;
|
||||
next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low;
|
||||
next_frame->obj_count = obj_count;
|
||||
next_frame->sd.fourcc = format;
|
||||
next_frame->sd.width = width;
|
||||
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(
|
||||
@ -212,11 +215,15 @@ void dmabuf_t::cancel(
|
||||
}
|
||||
|
||||
void frame_t::destroy() {
|
||||
for(auto x = 0; x < obj_count; ++x) {
|
||||
close(sd.fds[x]);
|
||||
if(!close_fds) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj_count = 0;
|
||||
for(auto x = 0; x < 4; ++x) {
|
||||
if(sd.fds[x] >= 0) {
|
||||
close(sd.fds[x]);
|
||||
}
|
||||
}
|
||||
close_fds = false;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) {
|
||||
|
@ -23,7 +23,7 @@ class frame_t {
|
||||
public:
|
||||
egl::surface_descriptor_t sd;
|
||||
|
||||
std::uint32_t obj_count;
|
||||
bool close_fds = false;
|
||||
|
||||
void destroy();
|
||||
};
|
||||
|
@ -261,10 +261,9 @@ public:
|
||||
img->sequence = sequence;
|
||||
|
||||
img->sd = current_frame->sd;
|
||||
img->sd.obj_count = current_frame->obj_count;
|
||||
|
||||
// Prevent dmabuf from closing the file descriptors.
|
||||
current_frame->obj_count = 0;
|
||||
current_frame->close_fds = false;
|
||||
|
||||
return platf::capture_e::ok;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user