Recreate surface every frame :(
This commit is contained in:
parent
6d75615e1d
commit
32459991c0
@ -40,6 +40,7 @@ typedef struct {
|
||||
VASurfaceID input_surface;
|
||||
VABufferID buffer_id;
|
||||
VARectangle input_region;
|
||||
bool context_created;
|
||||
} gsr_capture_kms_vaapi;
|
||||
|
||||
static int max_int(int a, int b) {
|
||||
@ -173,14 +174,6 @@ static void gsr_capture_kms_vaapi_tick(gsr_capture *cap, AVCodecContext *video_c
|
||||
cap_kms->stop_is_error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
VAStatus va_status = vaCreateConfig(cap_kms->va_dpy, VAProfileNone, VAEntrypointVideoProc, NULL, 0, &cap_kms->config_id);
|
||||
if(va_status != VA_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_tick: vaCreateConfig failed: %d\n", va_status);
|
||||
cap_kms->should_stop = true;
|
||||
cap_kms->stop_is_error = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,10 +195,6 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
||||
|
||||
VASurfaceID target_surface_id = (uintptr_t)frame->data[3];
|
||||
|
||||
static bool dd = false;
|
||||
if(!dd) {
|
||||
dd = true;
|
||||
|
||||
if(cap_kms->dmabuf_fd > 0) {
|
||||
close(cap_kms->dmabuf_fd);
|
||||
cap_kms->dmabuf_fd = 0;
|
||||
@ -225,11 +214,18 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
||||
cap_kms->kms_size.x = kms_response.data.fd.width;
|
||||
cap_kms->kms_size.y = kms_response.data.fd.height;
|
||||
|
||||
static bool cc = false;
|
||||
if(!cc) {
|
||||
cc = true;
|
||||
if(!cap_kms->context_created) {
|
||||
cap_kms->context_created = true;
|
||||
|
||||
VAStatus va_status = vaCreateContext(cap_kms->va_dpy, cap_kms->config_id, cap_kms->kms_size.x, cap_kms->kms_size.y, VA_PROGRESSIVE, &target_surface_id, 1, &cap_kms->context_id);
|
||||
VAStatus va_status = vaCreateConfig(cap_kms->va_dpy, VAProfileNone, VAEntrypointVideoProc, NULL, 0, &cap_kms->config_id);
|
||||
if(va_status != VA_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_tick: vaCreateConfig failed: %d\n", va_status);
|
||||
cap_kms->should_stop = true;
|
||||
cap_kms->stop_is_error = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
va_status = vaCreateContext(cap_kms->va_dpy, cap_kms->config_id, cap_kms->kms_size.x, cap_kms->kms_size.y, VA_PROGRESSIVE, &target_surface_id, 1, &cap_kms->context_id);
|
||||
if(va_status != VA_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "gsr error: gsr_capture_kms_vaapi_capture: vaCreateContext failed: %d\n", va_status);
|
||||
cap_kms->should_stop = true;
|
||||
@ -314,14 +310,13 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
||||
cap_kms->stop_is_error = true;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear texture with black background because the source texture (window_texture_get_opengl_texture_id(&cap_kms->window_texture))
|
||||
// might be smaller than cap_kms->target_texture_id
|
||||
// TODO:
|
||||
//cap_kms->egl.glClearTexImage(cap_kms->target_texture_id, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
VAStatus va_status = vaBeginPicture(cap_kms->va_dpy, cap_kms->context_id, target_surface_id);
|
||||
va_status = vaBeginPicture(cap_kms->va_dpy, cap_kms->context_id, target_surface_id);
|
||||
if(va_status != VA_STATUS_SUCCESS) {
|
||||
static bool error_printed = false;
|
||||
if(!error_printed) {
|
||||
|
Loading…
Reference in New Issue
Block a user