From 9084a960a565ed80d34c41c7b0ab4f4a716a4f54 Mon Sep 17 00:00:00 2001
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date: Wed, 15 Feb 2023 13:11:36 -0500
Subject: [PATCH] waylandsink: Let the baseclass know when frames are dropped

This is using the new GST_BASE_SINK_FLOW_DROPPED return value.
With this change, fpsdisplaysink will properly report the
render and dropped rate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3801>
---
 ext/gtk/gstgtkwaylandsink.c  | 2 ++
 ext/wayland/gstwaylandsink.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/ext/gtk/gstgtkwaylandsink.c b/ext/gtk/gstgtkwaylandsink.c
index 5288614bd7..acc32882ce 100644
--- a/ext/gtk/gstgtkwaylandsink.c
+++ b/ext/gtk/gstgtkwaylandsink.c
@@ -1006,6 +1006,7 @@ gst_gtk_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
   if (!priv->wl_window) {
     GST_LOG_OBJECT (self,
         "buffer %" GST_PTR_FORMAT " dropped (waiting for window)", buffer);
+    ret = GST_BASE_SINK_FLOW_DROPPED;
     goto done;
   }
 
@@ -1013,6 +1014,7 @@ gst_gtk_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
   if (priv->redraw_pending) {
     GST_LOG_OBJECT (self, "buffer %" GST_PTR_FORMAT " dropped (redraw pending)",
         buffer);
+    ret = GST_BASE_SINK_FLOW_DROPPED;
     goto done;
   }
 
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 6dd0807820..bbbcb93932 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -773,6 +773,7 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
   if (self->redraw_pending) {
     GST_LOG_OBJECT (self, "buffer %" GST_PTR_FORMAT " dropped (redraw pending)",
         buffer);
+    ret = GST_BASE_SINK_FLOW_DROPPED;
     goto done;
   }
 
-- 
2.25.1

