mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
eglglessink: Don't set the EAGLContext of the main thread and don't reuse it either
... instead create a new context for every sink instance. https://bugzilla.gnome.org/show_bug.cgi?id=720421
This commit is contained in:
parent
cf2cf20cc3
commit
d9525c134b
1 changed files with 7 additions and 12 deletions
|
@ -107,15 +107,10 @@ gst_egl_adaptation_create_egl_context (GstEglAdaptationContext * ctx)
|
|||
__block EAGLContext *context;
|
||||
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
EAGLContext *cur_ctx = [EAGLContext currentContext];
|
||||
if (cur_ctx) {
|
||||
context = cur_ctx;
|
||||
} else {
|
||||
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
if (context == nil) {
|
||||
GST_ERROR_OBJECT (ctx->element, "Failed to create EAGL GLES2 context");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ctx->eaglctx->eagl_context = context;
|
||||
|
@ -148,10 +143,6 @@ gst_egl_adaptation_context_make_current (GstEglAdaptationContext * ctx,
|
|||
return FALSE;
|
||||
}
|
||||
ctx_to_set = ctx->eaglctx->eagl_context;
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[EAGLContext setCurrentContext: ctx_to_set];
|
||||
});
|
||||
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (ctx->element, "Detaching context from thread %p",
|
||||
g_thread_self ());
|
||||
|
@ -178,6 +169,8 @@ gst_egl_adaptation_create_surface (GstEglAdaptationContext * ctx)
|
|||
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
|
||||
gst_egl_adaptation_context_make_current (ctx, TRUE);
|
||||
|
||||
if (ctx->eaglctx->framebuffer) {
|
||||
framebuffer = ctx->eaglctx->framebuffer;
|
||||
} else {
|
||||
|
@ -203,6 +196,8 @@ gst_egl_adaptation_create_surface (GstEglAdaptationContext * ctx)
|
|||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, depthRenderbuffer);
|
||||
|
||||
gst_egl_adaptation_context_make_current (ctx, FALSE);
|
||||
});
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
|
||||
|
|
Loading…
Reference in a new issue