eglglessink: Also unref current caps after usage
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 24 Sep 2012 10:36:12 +0000 (12:36 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 18 Oct 2012 12:35:14 +0000 (14:35 +0200)
ext/eglgles/gsteglglessink.c
ext/eglgles/gsteglglessink.h

index 135e1595fdca4329d80e33be28d3c7cd60514c2a..8cc90d5f5acb505a5a123c666835155afe847403 100644 (file)
@@ -1084,6 +1084,11 @@ gst_eglglessink_stop (GstBaseSink * sink)
     eglglessink->have_window = FALSE;
   }
 
+  if (eglglessink->current_caps) {
+    gst_caps_unref (eglglessink->current_caps);
+    eglglessink->current_caps = NULL;
+  }
+
   return TRUE;
 }
 
@@ -2112,35 +2117,40 @@ gst_eglglessink_setcaps (GstBaseSink * bsink, GstCaps * caps)
     if (gst_caps_can_intersect (caps, eglglessink->current_caps)) {
       GST_INFO_OBJECT (eglglessink, "Caps are compatible anyway");
       goto SUCCEED;
-    } else {
-      GST_DEBUG_OBJECT (eglglessink, "Caps are not compatible, reconfiguring");
-      if (eglglessink->rendering_path == GST_EGLGLESSINK_RENDER_SLOW) {
-        glDeleteBuffers (1, &eglglessink->vdata);
-        glDeleteBuffers (1, &eglglessink->tdata);
-        glDeleteBuffers (1, &eglglessink->idata);
-        eglglessink->have_vbo = FALSE;
-
-        glDeleteShader (eglglessink->fragshader);
-        glDeleteShader (eglglessink->vertshader);
-
-        glDeleteTextures (eglglessink->n_textures, eglglessink->texture);
-        eglglessink->have_texture = FALSE;
-        eglglessink->n_textures = 0;
-
-        glDeleteProgram (eglglessink->program);
-      }
+    }
 
-      if (eglglessink->surface) {
-        eglDestroySurface (eglglessink->display, eglglessink->surface);
-        eglglessink->surface = NULL;
-        eglglessink->have_surface = FALSE;
-      }
+    GST_DEBUG_OBJECT (eglglessink, "Caps are not compatible, reconfiguring");
+    if (eglglessink->rendering_path == GST_EGLGLESSINK_RENDER_SLOW) {
+      glDeleteBuffers (1, &eglglessink->vdata);
+      glDeleteBuffers (1, &eglglessink->tdata);
+      glDeleteBuffers (1, &eglglessink->idata);
+      eglglessink->have_vbo = FALSE;
 
-      if (eglglessink->context) {
-        eglDestroyContext (eglglessink->display, eglglessink->context);
-        eglglessink->context = NULL;
-      }
+      glDeleteShader (eglglessink->fragshader);
+      glDeleteShader (eglglessink->vertshader);
+
+      glDeleteTextures (eglglessink->n_textures, eglglessink->texture);
+      eglglessink->have_texture = FALSE;
+      eglglessink->n_textures = 0;
+
+      glDeleteProgram (eglglessink->program);
+    }
+
+    if (eglglessink->surface) {
+      eglDestroySurface (eglglessink->display, eglglessink->surface);
+      eglglessink->surface = NULL;
+      eglglessink->have_surface = FALSE;
+    }
+
+    if (eglglessink->context) {
+      eglDestroyContext (eglglessink->display, eglglessink->context);
+      eglglessink->context = NULL;
     }
+
+    g_mutex_lock (eglglessink->flow_lock);
+    gst_caps_unref (eglglessink->current_caps);
+    eglglessink->current_caps = NULL;
+    g_mutex_unlock (eglglessink->flow_lock);
   }
 
   if (!gst_eglglessink_choose_config (eglglessink)) {
index ac99980419244dd5a1b80ca97477a7256d4f9efd..5e20f4ae90d0e32b86a0eac95f8fe238d1112f33 100644 (file)
@@ -125,7 +125,6 @@ struct _GstEglGlesSink
   GstVideoSink videosink;
   GstVideoFormat format;
   GstCaps *current_caps;
-  GstPad *sink;
 
   GstVideoRectangle display_region;
   GList *supported_fmts;