mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
wayland: use a counter as sync flag
Wayland window has a pointer to the last pushed frame and use it to set the flag for stopping the queue dispatch loop. This may lead to memory leaks, since we are not keeping track of all the queued frames structures. This patch removes the last pushed frame pointer and change the binary flag for an atomic counter, keeping track of number of queued frames and use it for the queue dispatch loop. https://bugzilla.gnome.org/show_bug.cgi?id=749078
This commit is contained in:
parent
62c3888b76
commit
c80951ada1
1 changed files with 5 additions and 5 deletions
|
@ -107,7 +107,7 @@ struct _GstVaapiWindowWaylandPrivate
|
||||||
guint is_shown:1;
|
guint is_shown:1;
|
||||||
guint fullscreen_on_show:1;
|
guint fullscreen_on_show:1;
|
||||||
guint use_vpp:1;
|
guint use_vpp:1;
|
||||||
guint frame_pending:1;
|
volatile guint num_frames_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,7 +158,7 @@ gst_vaapi_window_wayland_sync (GstVaapiWindow * window)
|
||||||
struct wl_display *const wl_display =
|
struct wl_display *const wl_display =
|
||||||
GST_VAAPI_OBJECT_NATIVE_DISPLAY (window);
|
GST_VAAPI_OBJECT_NATIVE_DISPLAY (window);
|
||||||
|
|
||||||
while (priv->frame_pending) {
|
while (g_atomic_int_get (&priv->num_frames_pending) > 0) {
|
||||||
if (wl_display_dispatch_queue (wl_display, priv->event_queue) < 0)
|
if (wl_display_dispatch_queue (wl_display, priv->event_queue) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -321,10 +321,10 @@ frame_done_callback (void *data, struct wl_callback *callback, uint32_t time)
|
||||||
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (frame->window);
|
GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (frame->window);
|
||||||
|
|
||||||
if (priv->frame == frame) {
|
if (priv->frame == frame) {
|
||||||
priv->frame_pending = FALSE;
|
|
||||||
frame_state_free (frame);
|
|
||||||
priv->frame = NULL;
|
priv->frame = NULL;
|
||||||
}
|
}
|
||||||
|
frame_state_free (frame);
|
||||||
|
g_atomic_int_dec_and_test (&priv->num_frames_pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_callback_listener frame_callback_listener = {
|
static const struct wl_callback_listener frame_callback_listener = {
|
||||||
|
@ -477,7 +477,7 @@ gst_vaapi_window_wayland_render (GstVaapiWindow * window,
|
||||||
if (!frame)
|
if (!frame)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
priv->frame = frame;
|
priv->frame = frame;
|
||||||
priv->frame_pending = TRUE;
|
g_atomic_int_inc (&priv->num_frames_pending);
|
||||||
|
|
||||||
if (need_vpp && priv->use_vpp) {
|
if (need_vpp && priv->use_vpp) {
|
||||||
frame->surface = surface;
|
frame->surface = surface;
|
||||||
|
|
Loading…
Reference in a new issue