From e46e02a4745e20b139a5834d235fe2eeb992be14 Mon Sep 17 00:00:00 2001
From: Hugues Fruchet <hugues.fruchet@st.com>
Date: Fri, 22 Mar 2019 15:40:03 +0100
Subject: [PATCH 11/14] waylandsink: fallback to shm if display does not
 support dmabuf

Fallback to shm if display does not support dmabuf.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 ext/wayland/gstwaylandsink.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 0dc1f0d..e4952cb 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -618,15 +618,11 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
    */
   /* use_dmabuf = gst_caps_features_contains (gst_caps_get_features (caps, 0),
       GST_CAPS_FEATURE_MEMORY_DMABUF); */
-  use_dmabuf = TRUE;
+  use_dmabuf = gst_wl_display_check_format_for_dmabuf (sink->display, format);
 
-  /* validate the format base on the memory type */
-  if (use_dmabuf) {
-    if (!gst_wl_display_check_format_for_dmabuf (sink->display, format))
+  if (!use_dmabuf)
+    if (!gst_wl_display_check_format_for_shm (sink->display, format))
       goto unsupported_format;
-  } else if (!gst_wl_display_check_format_for_shm (sink->display, format)) {
-    goto unsupported_format;
-  }
 
   /* create a new pool for the new caps */
   if (sink->pool)
-- 
2.25.1

