mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
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
This commit is contained in:
parent
5a9541caff
commit
0f03e33b03
1 changed files with 18 additions and 14 deletions
|
@ -270,26 +270,30 @@ bool WPEThreadedView::initialize(GstWpeSrc* src, GstGLContext* context, GstGLDis
|
||||||
GstEGLImage* WPEThreadedView::image()
|
GstEGLImage* WPEThreadedView::image()
|
||||||
{
|
{
|
||||||
GstEGLImage* ret = nullptr;
|
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,
|
GMutexHolder lock(images.mutex);
|
||||||
images.committed,
|
|
||||||
GST_IS_EGL_IMAGE(images.committed) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.committed)) : 0);
|
|
||||||
|
|
||||||
if (images.pending) {
|
GST_TRACE("pending %" GST_PTR_FORMAT " (%d) committed %" GST_PTR_FORMAT " (%d)", images.pending,
|
||||||
auto* previousImage = images.committed;
|
GST_IS_EGL_IMAGE(images.pending) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.pending)) : 0,
|
||||||
images.committed = images.pending;
|
images.committed,
|
||||||
images.pending = nullptr;
|
GST_IS_EGL_IMAGE(images.committed) ? GST_MINI_OBJECT_REFCOUNT_VALUE(GST_MINI_OBJECT_CAST(images.committed)) : 0);
|
||||||
|
|
||||||
if (previousImage)
|
if (images.pending) {
|
||||||
gst_egl_image_unref(previousImage);
|
auto* previousImage = images.committed;
|
||||||
|
images.committed = images.pending;
|
||||||
|
images.pending = nullptr;
|
||||||
|
|
||||||
|
if (previousImage)
|
||||||
|
gst_egl_image_unref(previousImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (images.committed)
|
||||||
|
ret = images.committed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (images.committed) {
|
if (ret)
|
||||||
ret = images.committed;
|
|
||||||
frameComplete();
|
frameComplete();
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue