From 6d67b43352d01a586b48c100e6c3aa3a72b0d382 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Fri, 10 Dec 2021 16:08:27 +0100 Subject: [PATCH] ximagesrc: avoid blocking wait for X events XNextEvent() blocks indefinitely in absence of X11 events, which can prevent the pipeline from stopping. This can cause problems when ximagesrc is used in "remote desktop" scenarios and the GStreamer application itself, through which the user is viewing and controlling the machine, is the only source of input events. Replace the call with non-blocking XCheckTypedEvent(). Part-of: --- subprojects/gst-plugins-good/sys/ximage/gstximagesrc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/sys/ximage/gstximagesrc.c b/subprojects/gst-plugins-good/sys/ximage/gstximagesrc.c index b97d82c..2897008 100644 --- a/subprojects/gst-plugins-good/sys/ximage/gstximagesrc.c +++ b/subprojects/gst-plugins-good/sys/ximage/gstximagesrc.c @@ -547,9 +547,8 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc) do { XDamageNotifyEvent *damage_ev = (XDamageNotifyEvent *) (&ev); - XNextEvent (ximagesrc->xcontext->disp, &ev); - - if (ev.type == ximagesrc->damage_event_base + XDamageNotify && + if (XCheckTypedEvent (ximagesrc->xcontext->disp, + ximagesrc->damage_event_base + XDamageNotify, &ev) && damage_ev->level == XDamageReportNonEmpty) { XDamageSubtract (ximagesrc->xcontext->disp, ximagesrc->damage, None, -- 2.7.4