aboutsummaryrefslogtreecommitdiff
path: root/src/capture
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-07-23 05:24:17 +0200
committerdec05eba <dec05eba@protonmail.com>2023-07-23 05:24:17 +0200
commit64a301a279e5cc3e5b6053e22c4fffac7d1a8834 (patch)
tree77afa8989b8db2395d94583eba1dea3d44a26554 /src/capture
parentaf0961f64fa399c5faccee44b8c05e261a159385 (diff)
vaapi window capture cleanup
Diffstat (limited to 'src/capture')
-rw-r--r--src/capture/xcomposite_vaapi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/capture/xcomposite_vaapi.c b/src/capture/xcomposite_vaapi.c
index a1a8bb9..18bcf32 100644
--- a/src/capture/xcomposite_vaapi.c
+++ b/src/capture/xcomposite_vaapi.c
@@ -200,7 +200,7 @@ static void gsr_capture_xcomposite_vaapi_tick(gsr_capture *cap, AVCodecContext *
gsr_capture_xcomposite_vaapi *cap_xcomp = cap->priv;
// TODO:
- //cap_xcomp->params.egl->glClear(GL_COLOR_BUFFER_BIT);
+ cap_xcomp->params.egl->glClear(GL_COLOR_BUFFER_BIT);
bool init_new_window = false;
while(XPending(cap_xcomp->params.dpy)) {
@@ -444,6 +444,8 @@ static int gsr_capture_xcomposite_vaapi_capture(gsr_capture *cap, AVFrame *frame
(vec2i){0, 0}, cap_xcomp->texture_size,
texture_rotation);
+ cap_xcomp->params.egl->eglSwapBuffers(cap_xcomp->params.egl->egl_display, cap_xcomp->params.egl->egl_surface);
+
return 0;
}
@@ -452,6 +454,13 @@ static void gsr_capture_xcomposite_vaapi_stop(gsr_capture *cap, AVCodecContext *
gsr_color_conversion_deinit(&cap_xcomp->color_conversion);
+ for(uint32_t i = 0; i < cap_xcomp->prime.num_objects; ++i) {
+ if(cap_xcomp->prime.objects[i].fd > 0) {
+ close(cap_xcomp->prime.objects[i].fd);
+ cap_xcomp->prime.objects[i].fd = 0;
+ }
+ }
+
if(cap_xcomp->params.egl->egl_context) {
cap_xcomp->params.egl->glDeleteTextures(2, cap_xcomp->target_textures);
cap_xcomp->target_textures[0] = 0;