eglglessink: Only use the GstVideoFrame if we have a buffer
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 28 Dec 2012 11:40:14 +0000 (12:40 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 21 Mar 2013 09:00:39 +0000 (10:00 +0100)
ext/eglgles/gsteglglessink.c

index 460bdc3b28d339fc1d1f2273123e3a6cd671731b..8c0ef98df7f44f3af5c9f20b78582794904200fe 100644 (file)
@@ -1788,7 +1788,6 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
     GstBuffer * buf)
 {
   GstVideoFrame vframe;
-  gint w, h;
   guint dar_n, dar_d;
   GstVideoCropMeta *crop = NULL;
 
@@ -1802,16 +1801,19 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
       GST_ERROR_OBJECT (eglglessink, "Couldn't map frame");
       goto HANDLE_ERROR;
     }
+  } else {
+    GST_DEBUG_OBJECT (eglglessink, "Rendering previous buffer again");
   }
 
-  w = GST_VIDEO_FRAME_WIDTH (&vframe);
-  h = GST_VIDEO_FRAME_HEIGHT (&vframe);
+  if (buf) {
+    gint w, h;
 
-  GST_DEBUG_OBJECT (eglglessink,
-      "Got good buffer %p. Sink geometry is %dx%d size %d", buf, w, h,
-      buf ? gst_buffer_get_size (buf) : -1);
+    w = GST_VIDEO_FRAME_WIDTH (&vframe);
+    h = GST_VIDEO_FRAME_HEIGHT (&vframe);
+
+    GST_DEBUG_OBJECT (eglglessink,
+        "Got buffer %p: %dx%d size %d", buf, w, h, gst_buffer_get_size (buf));
 
-  if (buf) {
     switch (eglglessink->selected_fmt->fmt) {
       case GST_EGLGLESSINK_IMAGE_RGB888:{
         gint stride;
@@ -2283,11 +2285,11 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
       eglglessink->crop.y = crop->y;
       eglglessink->crop.w = crop->width;
       eglglessink->crop.h = crop->height;
-    } else {
+    } else if (buf) {
       eglglessink->crop.x = 0;
       eglglessink->crop.y = 0;
-      eglglessink->crop.w = w;
-      eglglessink->crop.h = h;
+      eglglessink->crop.w = GST_VIDEO_FRAME_WIDTH (&vframe);
+      eglglessink->crop.h = GST_VIDEO_FRAME_HEIGHT (&vframe);
     }
 
     if (!eglglessink->force_aspect_ratio) {