summaryrefslogtreecommitdiff
path: root/ext/wpe
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2020-10-06 22:19:21 +1100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-10-13 08:48:05 +0000
commit356fee4dd6303794adf90c7ca14269ef52a0f072 (patch)
tree260e28b910561a8ad0df478617dbb68aa3180c4f /ext/wpe
parentb84c8821de6bccd242d524c28d68503571382706 (diff)
downloadgstreamer-plugins-bad-356fee4dd6303794adf90c7ca14269ef52a0f072.tar.gz
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>
Diffstat (limited to 'ext/wpe')
-rw-r--r--ext/wpe/gstwpesrc.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/wpe/gstwpesrc.cpp b/ext/wpe/gstwpesrc.cpp
index 571619f41..c23495710 100644
--- a/ext/wpe/gstwpesrc.cpp
+++ b/ext/wpe/gstwpesrc.cpp
@@ -242,6 +242,7 @@ gst_wpe_src_start (GstWpeSrc * src)
GstGLContext *context = NULL;
GstGLDisplay *display = NULL;
GstGLBaseSrc *base_src = GST_GL_BASE_SRC (src);
+ gboolean created_view = FALSE;
GST_INFO_OBJECT (src, "Starting up");
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);
auto & thread = WPEContextThread::singleton ();
- src->view = thread.createWPEView (src, context, display,
- GST_VIDEO_INFO_WIDTH (&base_src->out_info),
- GST_VIDEO_INFO_HEIGHT (&base_src->out_info));
+
+ if (!src->view) {
+ src->view = thread.createWPEView (src, context, display,
+ GST_VIDEO_INFO_WIDTH (&base_src->out_info),
+ GST_VIDEO_INFO_HEIGHT (&base_src->out_info));
+ created_view = TRUE;
+ }
if (!src->view) {
GST_OBJECT_UNLOCK (src);
@@ -271,7 +276,9 @@ gst_wpe_src_start (GstWpeSrc * src)
src->bytes = NULL;
}
- src->n_frames = 0;
+ if (created_view) {
+ src->n_frames = 0;
+ }
GST_OBJECT_UNLOCK (src);
return TRUE;
}