wlwindow: Only update video info on new render

The sink->video_info might not reflect the current buffer
when expose is being called.

https://bugzilla.gnome.org/show_bug.cgi?id=790057
This commit is contained in:
Nicolas Dufresne 2017-11-21 23:10:03 -05:00
parent b06a8bffde
commit 51bb235cc6

View file

@ -602,7 +602,7 @@ static const struct wl_callback_listener frame_callback_listener = {
/* must be called with the render lock */
static void
render_last_buffer (GstWaylandSink * sink)
render_last_buffer (GstWaylandSink * sink, gboolean redraw)
{
GstWlBuffer *wlbuffer;
const GstVideoInfo *info = NULL;
@ -616,7 +616,7 @@ render_last_buffer (GstWaylandSink * sink)
callback = wl_surface_frame (surface);
wl_callback_add_listener (callback, &frame_callback_listener, sink);
if (G_UNLIKELY (sink->video_info_changed)) {
if (G_UNLIKELY (sink->video_info_changed && !redraw)) {
info = &sink->video_info;
sink->video_info_changed = FALSE;
}
@ -785,7 +785,7 @@ render:
}
gst_buffer_replace (&sink->last_buffer, to_render);
render_last_buffer (sink);
render_last_buffer (sink, FALSE);
if (buffer != to_render)
gst_buffer_unref (to_render);
@ -928,7 +928,7 @@ gst_wayland_sink_expose (GstVideoOverlay * overlay)
g_mutex_lock (&sink->render_lock);
if (sink->last_buffer && !sink->redraw_pending) {
GST_DEBUG_OBJECT (sink, "redrawing last buffer");
render_last_buffer (sink);
render_last_buffer (sink, TRUE);
}
g_mutex_unlock (&sink->render_lock);
}