diff options
authorVíctor Manuel Jáquez Leal <>2017-08-08 17:29:54 +0200
committerVíctor Manuel Jáquez Leal <>2017-08-24 13:04:22 +0200
commitf02eec2cee0b67e085f1918e2d57a17a0722ab80 (patch)
parent84870b16dde7c9d4262c01be72b4b69a3dc597ce (diff)
libs: windows: wayland: fail if cannot remove last frame
Converity scan bug: If the function returns an error value, the error value may be mistaken for a normal value. If g_atomic_pointer_compare_and_exchange() fails because the frame is not the last one, the function fails. Thus, logging an info message.
1 files changed, 7 insertions, 4 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
index 45934aa7..3d77e456 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
+++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
@@ -381,14 +381,16 @@ frame_done (FrameState * frame)
g_atomic_int_set (&frame->done, TRUE);
- g_atomic_pointer_compare_and_exchange (&priv->last_frame, frame, NULL);
- return g_atomic_int_dec_and_test (&priv->num_frames_pending);
+ if (g_atomic_pointer_compare_and_exchange (&priv->last_frame, frame, NULL))
+ return g_atomic_int_dec_and_test (&priv->num_frames_pending);
+ return FALSE;
static void
frame_done_callback (void *data, struct wl_callback *callback, uint32_t time)
- frame_done (data);
+ if (!frame_done (data))
+ GST_INFO ("cannot remove last frame because it didn't match or empty");
static const struct wl_callback_listener frame_callback_listener = {
@@ -401,7 +403,8 @@ frame_release_callback (void *data, struct wl_buffer *wl_buffer)
FrameState *const frame = data;
if (!frame->done)
- frame_done (frame);
+ if (!frame_done (frame))
+ GST_INFO ("cannot remove last frame because it didn't match or empty");
wl_buffer_destroy (wl_buffer);
frame_state_free (frame);