summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2019-05-28 17:43:25 +0200
committerTim-Philipp Müller <tim@centricular.com>2019-08-11 09:35:53 +0100
commit467656df0df9e6ade3808b90a4a4f9c549c14338 (patch)
treee8d231fa42874e857a79cdbfa2676cc8ec9628b4
parent1bfe5fd618d016ec53872d5a0591d78fd06eac58 (diff)
downloadgstreamer-plugins-base-467656df0df9e6ade3808b90a4a4f9c549c14338.tar.gz
gl/wayland: fix wayland event source burning CPU
Commit c71dd72b "gl/wayland: fix glib mainloop integration" was overeager in removing the poll result test from the check function. This caused dispatch to be called even if no new events are available on the Wayland connection, which in turn would wake up the glib mainloop, causing effectively a tight loop without ever blocking on the poll. Fixes #603
-rw-r--r--gst-libs/gst/gl/wayland/wayland_event_source.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/wayland/wayland_event_source.c b/gst-libs/gst/gl/wayland/wayland_event_source.c
index 3f9d482ff..553125efb 100644
--- a/gst-libs/gst/gl/wayland/wayland_event_source.c
+++ b/gst-libs/gst/gl/wayland/wayland_event_source.c
@@ -151,8 +151,12 @@ wayland_event_source_check (GSource * base)
source->reading = FALSE;
- if (wl_display_read_events (source->display) == 0)
- return TRUE;
+ if (source->pfd.revents & G_IO_IN) {
+ if (wl_display_read_events (source->display) == 0)
+ return TRUE;
+ } else {
+ wl_display_cancel_read (source->display);
+ }
return FALSE;
}