waylandsink: Emit "map" signal boarder surface is ready

This allows gtkwaylandsink to queue a draw of its gtk widget at the
correct time, avoiding a race.

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4754>
This commit is contained in:
Colin Kinloch 2023-05-26 13:26:42 +01:00 committed by Tim-Philipp Müller
parent b51727e9fa
commit 7faadfe882
2 changed files with 18 additions and 0 deletions

View file

@ -431,6 +431,17 @@ scrollable_window_adjustment_changed_cb (GtkAdjustment * adjustment,
return FALSE;
}
static void
wl_window_map_cb (GstWlWindow * wl_window, GstGtkWaylandSink * self)
{
GstGtkWaylandSinkPrivate *priv =
gst_gtk_wayland_sink_get_instance_private (self);
GST_DEBUG_OBJECT (self, "waylandsink surface is ready");
gtk_gst_base_widget_queue_draw (GTK_GST_BASE_WIDGET (priv->gtk_widget));
}
static void
setup_wl_window (GstGtkWaylandSink * self)
{
@ -457,6 +468,8 @@ setup_wl_window (GstGtkWaylandSink * self)
wl_surface, &priv->render_lock);
gst_wl_window_set_rotate_method (priv->wl_window,
priv->current_rotate_method);
g_signal_connect_object (priv->wl_window, "map",
G_CALLBACK (wl_window_map_cb), self, 0);
}
/* In order to position the subsurface correctly within a scrollable widget,

View file

@ -79,6 +79,7 @@ G_DEFINE_TYPE_WITH_CODE (GstWlWindow, gst_wl_window, G_TYPE_OBJECT,
enum
{
CLOSED,
MAP,
LAST_SIGNAL
};
@ -155,6 +156,9 @@ gst_wl_window_class_init (GstWlWindowClass * klass)
signals[CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
signals[MAP] = g_signal_new ("map", G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
}
static void
@ -509,6 +513,7 @@ gst_wl_window_render (GstWlWindow * self, GstWlBuffer * buffer,
gst_wl_window_update_borders (self);
wl_surface_commit (priv->area_surface_wrapper);
priv->is_area_surface_mapped = TRUE;
g_signal_emit (self, signals[MAP], 0);
}
} else {
/* clear both video and parent surfaces */