Commit graph

24 commits

Author SHA1 Message Date
Matthew Waters
3ed0ee95f2 wpesrc: fix possible small deadlock on shutdown
Problem is that unreffing the EGLImage/SHM Buffer while holding the
images_mutex lock may deadlock when a new buffer is advertised and
an attempt is made to lock the images_mutex there.

The advertisement of the new image/buffer is performed in the
WPEContextThread and the blocking dispatch when unreffing wants to run
something on the WPEContextThread however images_mutex has already been
locked by the destructor.

Delay unreffing images/buffers outside of images_mutex and instead just
clear the relevant fields within the lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1843>
2021-01-25 09:15:28 +00:00
Philippe Normand
3bcb876c29 wpe: Emit load-progress messages
The estimated-load-progress value can be used on application side to display a
progress bar for instance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1710>
2020-12-09 17:31:51 +00:00
Jan Schmidt
92472ef088 wpe: Don't crash when running on X11.
Don't assume the available EGL display is a wayland display -
instead, check the the GStreamer GL context is EGL, and then
use gst_gl_display_egl_from_gl_display to create a
GstGLDisplayEGL from that, which also adds refcounting
around the underlying EGLDisplay.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1385

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1752>
2020-11-15 15:27:08 +00:00
Matthew Waters
2f29a4cde6 wpesrc: add some debug logging around WPEView creation/destruction
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1663>
2020-10-13 08:48:05 +00:00
Matthew Waters
b84c8821de wpe: free a previous pending image/shm buffer
Don't blindly overwrite a possibly previously set buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1663>
2020-10-13 08:48:05 +00:00
Philippe Normand
c3659cd611 wpe: Plug SHM buffer leaks
Fixes #1409

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1568>
2020-09-21 16:39:57 +00:00
Philippe Normand
8ef30a9ce5 wpe: Move webview load waiting to WPEView
As waiting for the load to be finished is specific to the WebView, it should be
done from our WPEView, not from the WPEContextThread. This fixes issues where
multiple wpesrc elements are created in sequence. Without this patch the first
view might receive erroneous buffer notifications.

Fixes #1386

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1568>
2020-09-21 16:39:57 +00:00
Philippe Normand
b707454a5a wpe: Use proper callback for TLS errors signal handling
The load-failed and load-failed-with-tls-errors signals expect distinct callback
signatures.

Fixes #1388

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1566>
2020-09-21 14:11:15 +00:00
Philippe Normand
314a8c023f wpe: WebView and WebContext handling fixes
The WPEThreaded view is now split in 2 classes:
- WPEContextThread handles the persistent WebKit thread, where all WebKit API
calls should be handled.
- WPEView: is created from the WPEContextThread. It handles the WebView and
maintains the public interface on which wpesrc relies. This is the facade for
the WebView, basically. It takes care of dispatching API calls into the context
thread.

With these fixes it is now possible to create (and reuse) mutlple wpesrc
elements during the application lifetime.

Fixes #1372

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1484>
2020-08-14 09:41:56 +00:00
Mathieu Duponchelle
ad57b8040f wpe: fix ready signalling
Receiving the WEBKIT_LOAD_COMMITTED event doesn't actually
mean we have committed an SHM buffer / image yet.

As this is the condition we are interested in, check it
instead.

Also wrap g_cond_wait in a loop for extra correctness points.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1476>
2020-07-30 08:09:47 +00:00
Philippe Normand
991bcb22d5 wpe: Add support for SHM without requiring EGLDisplay
The previous version of the SHM export support still required a valid
EGLDisplay. The upcoming WPEBackend-FDO 1.8.x aims to remove this requirement,
hence allowing wpesrc to be used without GPU.
2020-04-13 11:53:16 +00:00
Philippe Normand
9ac798ae5e wpe: Add software rendering support support
Starting from WPEBackend-FDO 1.6.x, software rendering support is available.
This features allows wpesrc to be used on machines without GPU, and/or for
testing purpose. To enable it, set the `LIBGL_ALWAYS_SOFTWARE=true` environment
variable and make sure `video/x-raw, format=BGRA` caps are negotiated by the
wpesrc element.
2020-02-11 16:47:53 +00:00
Philippe Normand
b905501c55 wpe: Get rid of un-necessary frameComplete dispatchs
frameComplete() should be called only if there's a new commited frame.
2019-10-24 09:41:10 +00:00
Philippe Normand
0f03e33b03 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
2019-10-24 09:41:10 +00:00
Philippe Normand
a40476914d wpesrc: Implement load-bytes action signal 2019-10-17 08:15:44 +00:00
Philippe Normand
d7778e6a7c wpe: Rewrite wpesrc as a glbasesrc subclass
And since it no longer allocates memories itself, this fixes issues with
fakevideosink. A lot of code previously copied from gltestsrc is no longer
needed thanks to the glbasesrc super-class.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1046
2019-10-17 08:15:44 +00:00
Philippe Normand
3811d13269 wpe: Port for WPEWebKit 2.25.x
When WPEBackend-fdo >= 1.3.0 is detected, the threaded view now relies on the
wpe_fdo_egl_exported_image API instead of the EGLImageKHR-based API which is
going to be deprecated in 2.26. The GLib sources created by the view now use the
default priority as well, the custom priority is no longer required.
2019-06-25 10:16:25 +00:00
Philippe Normand
5105bc8041 wpe: Fix build with -Werror enabled
Including gl.h from WPEThreadedView.h leads to GST_LEVEL_DEFAULT detected as
redefined. The proposed fix is to include config.h from the CPP implementation
file and disable gl.h inclusion in the header, by using forward declarations.
2019-06-05 12:47:16 +01:00
Philippe Normand
2b218da805 wpesrc: Switch to WPEBackend-fdo 1.2.0 2019-03-30 14:02:50 +00:00
Philippe Normand
6c228eef59 wpesrc: Register backend activity states 2019-03-20 10:14:51 +00:00
Philippe Normand
22b94a7a84 wpesrc: Always log loaded URI 2019-03-20 10:14:51 +00:00
Philippe Normand
451074a7e0 wpesrc: Implement webview background configuration support 2019-03-20 10:14:51 +00:00
Philippe Normand
c34cd8c5e0 wpesrc: Plug WPE's exportable leak 2019-01-22 11:52:30 +00:00
Philippe Normand
5b8935bc77 wpe: Add a source element acting as a Web Browser based on WebKit WPE
The wpe element is used to produce a video texture representing a web page
rendered off-screen by WPE. This element can be used to overlay HTML on top of
another video stream for instance.
2018-12-06 12:38:52 +00:00