eglglessink: Terminate display connection at caps renego

This commit is contained in:
Reynaldo H. Verdejo Pinochet 2012-10-03 23:41:52 -03:00 committed by Sebastian Dröge
parent 734ac85bb4
commit 2ab9de8e4f

View file

@ -1461,7 +1461,7 @@ gst_eglglessink_context_make_current (GstEglGlesSink * eglglessink, gboolean bin
if (bind && eglglessink->eglglesctx->surface && eglglessink->eglglesctx->eglcontext) {
if (streaming_thread) {
EGLContext *ctx = eglGetCurrentContext ();
if (ctx == eglglessink->eglglesctx->eglcontext) {
GST_DEBUG_OBJECT (eglglessink, "Already attached the context");
return TRUE;
@ -2276,7 +2276,7 @@ gst_eglglessink_setcaps (GstBaseSink * bsink, GstCaps * caps)
g_mutex_unlock (eglglessink->flow_lock);
if (eglglessink->current_caps) {
GST_ERROR_OBJECT (eglglessink, "Caps already set. Won't do it again");
GST_ERROR_OBJECT (eglglessink, "Caps were already set");
if (gst_caps_can_intersect (caps, eglglessink->current_caps)) {
GST_INFO_OBJECT (eglglessink, "Caps are compatible anyway");
goto SUCCEED;
@ -2284,6 +2284,7 @@ gst_eglglessink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_DEBUG_OBJECT (eglglessink, "Caps are not compatible, reconfiguring");
/* Cleanup */
if (eglglessink->rendering_path == GST_EGLGLESSINK_RENDER_SLOW) {
glUseProgram (0);
@ -2326,6 +2327,25 @@ gst_eglglessink_setcaps (GstBaseSink * bsink, GstCaps * caps)
eglglessink->eglglesctx->eglcontext = NULL;
}
/* Terminate display connection */
if (eglMakeCurrent (eglglessink->eglglesctx->display, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE) {
show_egl_error ("eglMakeCurrent");
goto HANDLE_ERROR;
}
if (eglTerminate (eglglessink->eglglesctx->display) == EGL_FALSE) {
show_egl_error ("eglTerminate");
goto HANDLE_ERROR;
}
eglglessink->eglglesctx->display = NULL;
if (!gst_eglglessink_init_egl_display (eglglessink)) {
GST_ERROR_OBJECT (eglglessink, "Could not reinit display connection");
goto HANDLE_ERROR;
}
g_mutex_lock (eglglessink->flow_lock);
gst_caps_unref (eglglessink->current_caps);
eglglessink->current_caps = NULL;