aboutsummaryrefslogtreecommitdiff
path: root/src/capture/kms.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-15 08:21:54 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-15 08:21:54 +0200
commit0b9d232ce8881ccf991817862e2e5b3a8bc0a73d (patch)
treee4828d0459ba4bc77d3ba44f03211411ef991858 /src/capture/kms.c
parent8e3014aa97d30ba3b24d5409be00db6ecd76f4b3 (diff)
Fix crash, use opengl es instead of opengl desktop
Diffstat (limited to 'src/capture/kms.c')
-rw-r--r--src/capture/kms.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/capture/kms.c b/src/capture/kms.c
index 7785d8d..1616bd7 100644
--- a/src/capture/kms.c
+++ b/src/capture/kms.c
@@ -287,7 +287,6 @@ static bool gsr_capture_kms_bind_image_to_texture(gsr_capture_kms *self, EGLImag
self->params.egl->glBindTexture(texture_target, texture_id);
self->params.egl->glEGLImageTargetTexture2DOES(texture_target, image);
const bool success = self->params.egl->glGetError() == 0;
- self->params.egl->eglDestroyImage(self->params.egl->egl_display, image);
self->params.egl->glBindTexture(texture_target, 0);
return success;
}
@@ -388,12 +387,15 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
gsr_capture_kms_bind_image_to_texture(self, image, self->external_input_texture_id, true);
} else {
if(!gsr_capture_kms_bind_image_to_texture(self, image, self->input_texture_id, false)) {
- fprintf(stderr, "gsr error: gsr_pipewire_map_texture: failed to bind image to texture, trying with external texture\n");
+ fprintf(stderr, "gsr error: gsr_capture_kms_capture: failed to bind image to texture, trying with external texture\n");
self->external_texture_fallback = true;
gsr_capture_kms_bind_image_to_texture(self, image, self->external_input_texture_id, true);
}
}
+ if(image)
+ self->params.egl->eglDestroyImage(self->params.egl->egl_display, image);
+
vec2i capture_pos = self->capture_pos;
if(!capture_is_combined_plane)
capture_pos = (vec2i){drm_fd->x, drm_fd->y};
@@ -453,9 +455,11 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
const int target = cursor_texture_id_is_external ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
self->params.egl->glBindTexture(target, self->cursor_texture_id);
self->params.egl->glEGLImageTargetTexture2DOES(target, cursor_image);
- self->params.egl->eglDestroyImage(self->params.egl->egl_display, cursor_image);
self->params.egl->glBindTexture(target, 0);
+ if(cursor_image)
+ self->params.egl->eglDestroyImage(self->params.egl->egl_display, cursor_image);
+
self->params.egl->glEnable(GL_SCISSOR_TEST);
self->params.egl->glScissor(target_x, target_y, self->capture_size.x, self->capture_size.y);