MMFMWK-7954 waylandsink: change to using GCond to avoid dropping video buffer

upstream status: imx specific
https://bugzilla.gnome.org/show_bug.cgi?id=794793
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index ff08194..4b8e7f9 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -209,6 +209,7 @@
 {
   g_mutex_init (&sink->display_lock);
   g_mutex_init (&sink->render_lock);
+  g_cond_init (&sink->redraw_wait);
 }
 
 static void
@@ -267,6 +268,7 @@
 
   g_mutex_clear (&sink->display_lock);
   g_mutex_clear (&sink->render_lock);
+  g_cond_clear (&sink->redraw_wait);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -599,6 +601,7 @@
 
   g_mutex_lock (&sink->render_lock);
   sink->redraw_pending = FALSE;
+  g_cond_signal (&sink->redraw_wait);
   g_mutex_unlock (&sink->render_lock);
 
   wl_callback_destroy (callback);
@@ -663,11 +666,8 @@
     }
   }
 
-  /* drop buffers until we get a frame callback */
-  if (sink->redraw_pending) {
-    GST_LOG_OBJECT (sink, "buffer %p dropped (redraw pending)", buffer);
-    goto done;
-  }
+  while (sink->redraw_pending)
+    g_cond_wait (&sink->redraw_wait, &sink->render_lock);
 
   /* make sure that the application has called set_render_rectangle() */
   if (G_UNLIKELY (sink->window->render_rectangle.w == 0))
diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
index 2704d00..5224138 100644
--- a/ext/wayland/gstwaylandsink.h
+++ b/ext/wayland/gstwaylandsink.h
@@ -64,6 +64,7 @@
   gchar *display_name;
 
   gboolean redraw_pending;
+  GCond redraw_wait;
   GMutex render_lock;
   GstBuffer *last_buffer;
 };