waylandsink/wlwindow: do not commit a resize when it happens due to a video info change

1) We know that gst_wayland_sink_render() will commit the surface
   in the same thread a little later, as gst_wl_window_set_video_info()
   is always called from there, so we can save the compositor from
   some extra calculations.
2) We should not commit a resize with the new video info while we are still
   showing the buffer of the previous video, with the old caps, as that
   would probably be a visible resize glitch.
This commit is contained in:
George Kiagiadakis 2014-06-13 16:37:38 +02:00
parent 04b0e54838
commit e5334a1f8b

View file

@ -185,7 +185,7 @@ gst_wl_window_is_toplevel (GstWlWindow * window)
}
static void
gst_wl_window_resize_internal (GstWlWindow * window)
gst_wl_window_resize_internal (GstWlWindow * window, gboolean commit)
{
GstVideoRectangle src, res;
@ -198,8 +198,10 @@ gst_wl_window_resize_internal (GstWlWindow * window)
window->render_rectangle.x + res.x, window->render_rectangle.y + res.y);
wl_viewport_set_destination (window->viewport, res.w, res.h);
wl_surface_damage (window->surface, 0, 0, res.w, res.h);
wl_surface_commit (window->surface);
if (commit) {
wl_surface_damage (window->surface, 0, 0, res.w, res.h);
wl_surface_commit (window->surface);
}
/* this is saved for use in wl_surface_damage */
window->surface_width = res.w;
@ -216,7 +218,7 @@ gst_wl_window_set_video_info (GstWlWindow * window, GstVideoInfo * info)
window->video_height = info->height;
if (window->render_rectangle.w != 0)
gst_wl_window_resize_internal (window);
gst_wl_window_resize_internal (window, FALSE);
}
void
@ -231,5 +233,5 @@ gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
window->render_rectangle.h = h;
if (window->video_width != 0)
gst_wl_window_resize_internal (window);
gst_wl_window_resize_internal (window, TRUE);
}