wayland: rename frame for last_frame

Since frame in the private data means the last frame sent, it would
semantically better use last_frame.

Also, this patch makes use of g_atomic_pointer_{compare_and_exchange, set}()
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=749078
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-05-07 18:30:33 +02:00
parent c80951ada1
commit 882387de30

View file

@ -100,7 +100,7 @@ struct _GstVaapiWindowWaylandPrivate
struct wl_surface *surface; struct wl_surface *surface;
struct wl_region *opaque_region; struct wl_region *opaque_region;
struct wl_event_queue *event_queue; struct wl_event_queue *event_queue;
FrameState *frame; FrameState *last_frame;
GstVideoFormat surface_format; GstVideoFormat surface_format;
GstVaapiVideoPool *surface_pool; GstVaapiVideoPool *surface_pool;
GstVaapiFilter *filter; GstVaapiFilter *filter;
@ -267,9 +267,9 @@ gst_vaapi_window_wayland_destroy (GstVaapiWindow * window)
GstVaapiWindowWaylandPrivate *const priv = GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window); GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);
if (priv->frame) { if (priv->last_frame) {
frame_state_free (priv->frame); frame_state_free (priv->last_frame);
priv->frame = NULL; priv->last_frame = NULL;
} }
if (priv->shell_surface) { if (priv->shell_surface) {
@ -320,9 +320,7 @@ frame_done_callback (void *data, struct wl_callback *callback, uint32_t time)
GstVaapiWindowWaylandPrivate *const priv = GstVaapiWindowWaylandPrivate *const priv =
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (frame->window); GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (frame->window);
if (priv->frame == frame) { g_atomic_pointer_compare_and_exchange (&priv->last_frame, frame, NULL);
priv->frame = NULL;
}
frame_state_free (frame); frame_state_free (frame);
g_atomic_int_dec_and_test (&priv->num_frames_pending); g_atomic_int_dec_and_test (&priv->num_frames_pending);
} }
@ -476,7 +474,7 @@ gst_vaapi_window_wayland_render (GstVaapiWindow * window,
frame = frame_state_new (window); frame = frame_state_new (window);
if (!frame) if (!frame)
return FALSE; return FALSE;
priv->frame = frame; g_atomic_pointer_set (&priv->last_frame, frame);
g_atomic_int_inc (&priv->num_frames_pending); g_atomic_int_inc (&priv->num_frames_pending);
if (need_vpp && priv->use_vpp) { if (need_vpp && priv->use_vpp) {