aboutsummaryrefslogtreecommitdiff
path: root/src/capture/kms_vaapi.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-10-22 04:56:34 +0200
committerdec05eba <dec05eba@protonmail.com>2023-10-22 04:56:34 +0200
commit51154b71be6be742541f53a21b5c9d39d0033270 (patch)
tree348cc95ce90744c14884b2821136586b5ea8ed09 /src/capture/kms_vaapi.c
parent44d50065b92284638398b4989490ac66eb34c53e (diff)
Fix vram leak for reals
Diffstat (limited to 'src/capture/kms_vaapi.c')
-rw-r--r--src/capture/kms_vaapi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/capture/kms_vaapi.c b/src/capture/kms_vaapi.c
index 5899f9f..681f345 100644
--- a/src/capture/kms_vaapi.c
+++ b/src/capture/kms_vaapi.c
@@ -547,6 +547,13 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->params.egl->eglSwapBuffers(cap_kms->params.egl->egl_display, cap_kms->params.egl->egl_surface);
+ return 0;
+}
+
+static void gsr_capture_kms_vaapi_capture_end(gsr_capture *cap, AVFrame *frame) {
+ (void)frame;
+ gsr_capture_kms_vaapi *cap_kms = cap->priv;
+
gsr_egl_cleanup_frame(cap_kms->params.egl);
for(int i = 0; i < cap_kms->kms_response.num_fds; ++i) {
@@ -555,8 +562,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
cap_kms->kms_response.fds[i].fd = 0;
}
cap_kms->kms_response.num_fds = 0;
-
- return 0;
}
static void gsr_capture_kms_vaapi_stop(gsr_capture *cap, AVCodecContext *video_codec_context) {
@@ -647,6 +652,7 @@ gsr_capture* gsr_capture_kms_vaapi_create(const gsr_capture_kms_vaapi_params *pa
.tick = gsr_capture_kms_vaapi_tick,
.should_stop = gsr_capture_kms_vaapi_should_stop,
.capture = gsr_capture_kms_vaapi_capture,
+ .capture_end = gsr_capture_kms_vaapi_capture_end,
.destroy = gsr_capture_kms_vaapi_destroy,
.priv = cap_kms
};