diff options
author | Philippe Normand <philn@igalia.com> | 2019-10-19 12:48:55 +0100 |
---|---|---|
committer | Philippe Normand <philn@igalia.com> | 2019-10-24 09:41:10 +0000 |
commit | 0f03e33b03456d673550ad72d5dc14fc27ecbea3 (patch) | |
tree | 0a7a10ae37cb272ae5f0df597bfdb734c3f4d1c2 /ext/wpe | |
parent | 5a9541caffece8d0c8b570258d897bb20b663bdb (diff) | |
download | gstreamer-plugins-bad-0f03e33b03456d673550ad72d5dc14fc27ecbea3.tar.gz |
wpe: Run frameComplete outside of images mutex scope
If the mutex is locked while running frameComplete there is a potential deadlock
bound to happen when we get a new exported images from the backend.
Fixes #1101
Diffstat (limited to 'ext/wpe')
-rw-r--r-- | ext/wpe/WPEThreadedView.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/wpe/WPEThreadedView.cpp b/ext/wpe/WPEThreadedView.cpp index a380ed39c..4d6cafa01 100644 --- a/ext/wpe/WPEThreadedView.cpp +++ b/ext/wpe/WPEThreadedView.cpp @@ -270,26 +270,30 @@ bool WPEThreadedView::initialize(GstWpeSrc* src, GstGLContext* context, GstGLDis GstEGLImage* WPEThreadedView::image() { GstEGLImage* ret = nullptr; - GMutexHolder lock(images.mutex); - GST_TRACE("pending %" GST_PTR_FORMAT " (%d) committed %" GST_PTR_FORMAT " (%d)", images.pending, - GST_IS_EGL_IMAGE(images.pending) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.pending)) : 0, - images.committed, - GST_IS_EGL_IMAGE(images.committed) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.committed)) : 0); + { + GMutexHolder lock(images.mutex); + + GST_TRACE("pending %" GST_PTR_FORMAT " (%d) committed %" GST_PTR_FORMAT " (%d)", images.pending, + GST_IS_EGL_IMAGE(images.pending) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.pending)) : 0, + images.committed, + GST_IS_EGL_IMAGE(images.committed) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.committed)) : 0); + + if (images.pending) { + auto* previousImage = images.committed; + images.committed = images.pending; + images.pending = nullptr; - if (images.pending) { - auto* previousImage = images.committed; - images.committed = images.pending; - images.pending = nullptr; + if (previousImage) + gst_egl_image_unref(previousImage); + } - if (previousImage) - gst_egl_image_unref(previousImage); + if (images.committed) + ret = images.committed; } - if (images.committed) { - ret = images.committed; + if (ret) frameComplete(); - } return ret; } |