summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-08 17:29:54 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-08 17:29:54 +0200
commit775f912247b246539a8f8bcc66dbbba4f1add167 (patch)
treee2a1bdf043c611c91e7c7b12f64ce048c116f9c0
parentfbffda4e2f75ef31080f3a8480246018a006300f (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.
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow_wayland.c11
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)
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (frame->window);
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);
}