mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
wpesrc: only create webview if not already created
e.g. _decide_allocation() can be called multiple times throughout the element's lifetime and we only want to create the view once rather than overwriting. Fixes a leak of the WPEView under certain circumstances. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1663>
This commit is contained in:
parent
b84c8821de
commit
356fee4dd6
1 changed files with 11 additions and 4 deletions
|
@ -242,6 +242,7 @@ gst_wpe_src_start (GstWpeSrc * src)
|
||||||
GstGLContext *context = NULL;
|
GstGLContext *context = NULL;
|
||||||
GstGLDisplay *display = NULL;
|
GstGLDisplay *display = NULL;
|
||||||
GstGLBaseSrc *base_src = GST_GL_BASE_SRC (src);
|
GstGLBaseSrc *base_src = GST_GL_BASE_SRC (src);
|
||||||
|
gboolean created_view = FALSE;
|
||||||
|
|
||||||
GST_INFO_OBJECT (src, "Starting up");
|
GST_INFO_OBJECT (src, "Starting up");
|
||||||
GST_OBJECT_LOCK (src);
|
GST_OBJECT_LOCK (src);
|
||||||
|
@ -254,9 +255,13 @@ gst_wpe_src_start (GstWpeSrc * src)
|
||||||
GST_DEBUG_OBJECT (src, "Will fill GLMemories: %d\n", src->gl_enabled);
|
GST_DEBUG_OBJECT (src, "Will fill GLMemories: %d\n", src->gl_enabled);
|
||||||
|
|
||||||
auto & thread = WPEContextThread::singleton ();
|
auto & thread = WPEContextThread::singleton ();
|
||||||
|
|
||||||
|
if (!src->view) {
|
||||||
src->view = thread.createWPEView (src, context, display,
|
src->view = thread.createWPEView (src, context, display,
|
||||||
GST_VIDEO_INFO_WIDTH (&base_src->out_info),
|
GST_VIDEO_INFO_WIDTH (&base_src->out_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&base_src->out_info));
|
GST_VIDEO_INFO_HEIGHT (&base_src->out_info));
|
||||||
|
created_view = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!src->view) {
|
if (!src->view) {
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
@ -271,7 +276,9 @@ gst_wpe_src_start (GstWpeSrc * src)
|
||||||
src->bytes = NULL;
|
src->bytes = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (created_view) {
|
||||||
src->n_frames = 0;
|
src->n_frames = 0;
|
||||||
|
}
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue