aboutsummaryrefslogtreecommitdiff
path: root/src/capture/portal.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-08 02:03:03 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-08 02:03:03 +0200
commit36951238befd78b274e1e967789bbe2e23979b8b (patch)
tree57a27603d0419050eb0002d56a733802bc823e0f /src/capture/portal.c
parent846241189e2a73dcd11605d3f77d61dce0469e02 (diff)
Fix possible capture lag (especially with desktop portal capture)
Diffstat (limited to 'src/capture/portal.c')
-rw-r--r--src/capture/portal.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/capture/portal.c b/src/capture/portal.c
index 00972e3..fa6f61f 100644
--- a/src/capture/portal.c
+++ b/src/capture/portal.c
@@ -320,18 +320,20 @@ static int gsr_capture_portal_capture(gsr_capture *cap, AVFrame *frame, gsr_colo
(vec2i){region.x, region.y}, self->capture_size,
0.0f, false);
- const vec2i cursor_pos = {
- target_x + cursor_region.x,
- target_y + cursor_region.y
- };
-
- self->params.egl->glEnable(GL_SCISSOR_TEST);
- self->params.egl->glScissor(target_x, target_y, self->capture_size.x, self->capture_size.y);
- gsr_color_conversion_draw(color_conversion, self->cursor_texture_id,
- (vec2i){cursor_pos.x, cursor_pos.y}, (vec2i){cursor_region.width, cursor_region.height},
- (vec2i){0, 0}, (vec2i){cursor_region.width, cursor_region.height},
- 0.0f, false);
- self->params.egl->glDisable(GL_SCISSOR_TEST);
+ if(self->params.record_cursor) {
+ const vec2i cursor_pos = {
+ target_x + cursor_region.x,
+ target_y + cursor_region.y
+ };
+
+ self->params.egl->glEnable(GL_SCISSOR_TEST);
+ self->params.egl->glScissor(target_x, target_y, self->capture_size.x, self->capture_size.y);
+ gsr_color_conversion_draw(color_conversion, self->cursor_texture_id,
+ (vec2i){cursor_pos.x, cursor_pos.y}, (vec2i){cursor_region.width, cursor_region.height},
+ (vec2i){0, 0}, (vec2i){cursor_region.width, cursor_region.height},
+ 0.0f, false);
+ self->params.egl->glDisable(GL_SCISSOR_TEST);
+ }
//self->params.egl->glFlush();
//self->params.egl->glFinish();