Commit graph

74 commits

Author SHA1 Message Date
Philippe Normand 5dc39091f3 wpe: Add support for web:// URIs
The CEF source already supports this. No good reason for wpesrc not too ;)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2503>
2021-09-13 15:02:24 +00:00
Thibault Saunier cd3aa029d6 wpe: Fix race condition on teardown
There was a race when going to PAUSED while pushing a buffer to the
pipeline process (where we weren't even cancelling anything).

This rework base all the cancellation around the GCancellable
"cancelled" signal trying to ensure that the streaming thread will not
block once a cancel operation happens.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2504>
2021-09-03 15:56:31 +00:00
Thibault Saunier f7cbbb5d9a wpe: Use the new element.get_current_running_time API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2504>
2021-09-03 15:56:31 +00:00
Thibault Saunier 0531eebf51 wpe: Mark first buffer as starting at 0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2504>
2021-09-03 15:56:31 +00:00
Philippe Normand cfc80e5168 wpevideosrc: Uniformise default value for draw-background property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2498>
2021-08-31 17:59:06 +00:00
Philippe Normand 2b6f0404a7 wpevideosrc: Implement basic heuristic for raw caps negotiation
Before this patch raw caps could be negotiated already with a capsfilter, but in
cases where wpesrc is being auto-plugged this approach can't be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2498>
2021-08-31 17:59:06 +00:00
Philippe Normand edc04df13c wpevideosrc: Ensure debug category is set
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2498>
2021-08-31 17:59:06 +00:00
Philippe Normand 108eba3603 wpesrcbin: Use gst_buffer_new_memdup()
g_memdup() is deprecated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2406>
2021-07-13 16:03:10 +00:00
Thibault Saunier c7684b48d0 wpe: Rename undeserializable_type to not_deserializable_type
Making it more readable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier da150c18bb wpe: Make forwarded messages layout more like GstBinForwaded messages
Making it look more like how we do this kind of things in other places.

See: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252#note_927653
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier f29e75d1da wpe: Make wpesrc!video pad an always pad
There should always be a `video` pad no matter what.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier 870d9b8bd6 wpe: Remove unused env var
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier 81a0125a97 wpe: Fix atomic usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier 3ffd78787d wpe: Add a note able requiring tracing subsystem for message forwarding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier c38e0cfdb0 wpe: Fix check on whether MEMFD_CREATE is available
The ordering of the ifdef was wrong

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier d93131bfee wpe: Plug a leak
We were freeing after returning

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Thibault Saunier ca1812f38c Revert "wpe: Properly respect LIBGL_ALWAYS_SOFTWARE"
This causes issues I didn't see:
     https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252#note_927633

Let's just tell people to use capsfilter to force software rendering in
`wpesrc` for now.

The intent was to allow forcing it easily in playbin2 for the CI, but
we will do it some other way and see when time comes.

This reverts commit 9415106b02.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2273>
2021-06-08 03:15:05 +00:00
Philippe Normand a0b37e9d1a wpe: Bump wpebackend-fdo version requirement to 1.8
Debian bullseye has this version already, and this allows us to get rid of many
ifdefs. The mouse scroll handling is actually functional now as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2278>
2021-05-23 17:18:20 +00:00
Thibault Saunier 818db8f0b3 wpe: Bump WPE dependency to 2.28
The new audio feature depends on WPE 2.28 so we should just bump our
requirement to that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2264>
2021-05-19 18:50:29 -04:00
Thibault Saunier c98fe5b7f9 wpe: Update doc cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:16 +00:00
Thibault Saunier 9415106b02 wpe: Properly respect LIBGL_ALWAYS_SOFTWARE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Thibault Saunier 4dbfae0105 wpe: Relay messages from WPE internal pipelines
It is based on a tracer as it allows us to very easily get
every message that are posted on any bus inside the process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Thibault Saunier a92d4373ad wpe: Base wpe audio implementation on a web extension
This makes the implementation simpler and enable us to map
webviews and audio stream much more easily

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Philippe Normand 81ced7932f wpe: Enable WebAudio
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Philippe Normand f4bc5c6c65 wpe: Implement audio support
The wpesrc bin now exposes "sometimes" audio src pads, one for every PCM audio
stream created by WPEWebKit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Thibault Saunier cb4f6c877e wpe: Move wpesrc to wpevideosrc and add a wrapper bin wpesrc
Currently the bin contains a single element but we are going
to implement audio support and expose extra pads for audio

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252>
2021-05-19 13:41:15 +00:00
Jan Alexander Steffens (heftig) c9a04ca979 wpe: Properly free property fields
The set location (in two places) and loaded bytes were not freed when
the element is destroyed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2222>
2021-05-07 16:01:49 +00:00
Jan Alexander Steffens (heftig) 950d5eedf9 wpe: Properly lock property fields
Use the object lock for the following fields:
 - `bytes`: Written by the `load-bytes` signal unless running; consumed
   on start.
 - `draw_background`: Read and written by the `draw-background`
   property.
 - `location`: Read and written by the `location` property and the URI
   handler.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2222>
2021-05-07 16:01:49 +00:00
Thibault Saunier a6c591b339 wpe: Remove code targeting WebKit < 2.24
We already depend on wk >= 2.24

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2165>
2021-04-15 14:06:59 -04:00
Thibault Saunier f9ce3946a1 wpe: Make threaded view singleton creation thread safe
It was leading to interesting failures.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2165>
2021-04-15 13:29:43 -04:00
Stéphane Cerveau 1fd8b4a6b7 wpe: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
2021-03-23 14:19:17 +00:00
Thibault Saunier 8a0224a198 wpe: Ignore 'error-cancelled' 'failures'
This happens when the user use the 'load-bytes' signal and nothing is wrong there

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2085>
2021-03-16 13:06:22 +00:00
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
Matthew Waters 94fea694bc wpesrc: replace object lock usage with a new lock
Using the object lock is problematic for anything that can dispatch to
another thread which is what createWPEView() does inside
gst_wpe_src_start().  Using the object lock there can cause a deadlock.

One example of such a deadlock is when createWPEView is called, but
another (or the same) wpesrc is on the WPEContextThread and e.g. posts a
bus message.  This message propagations takes and releases the object
lock of numerous elements in quick succession for determining various
information about the elements in the bin.  If the object lock is
already held, then the message propagation will block and stall bin
processing (state changes, other messages) and wpe servicing any events.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1934>
2021-01-12 08:35:10 +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
Philippe Normand 37b7809d18 wpe: Convert launch lines to markdown and move since tag
Seems like the examples don't appear in the generated docs because the Since tag
was badly positioned in the doc blurb.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1706>
2020-10-18 15:17:25 +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 da18a8d93d wpesrc: fix a memory leak of the bytes
free the previous GBytes if load-bytes is called multiple times
before view creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1663>
2020-10-13 08:48:05 +00:00
Matthew Waters 356fee4dd6 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>
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
Matthew Waters b003387526 wpesrc: fix some caps leaks using the non-GL output
Always chain up to the parent _stop() implementation as it unrefs some
caps (among other things).

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1409
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1618>
2020-09-30 12:10:44 +00:00
Philippe Normand 2e8927ce93 wpe: Plug event leak
Handled events don't go through the default pad event handler, so they need to
be unreffed in this case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1568>
2020-09-21 16:39:57 +00:00
Jan Schmidt 6fc7455881 wpesrc: Don't crash if WPE doesn't generate a buffer.
On creating a 2nd wpesrc in a new pipeline in an app that already
has a runnig wpesrc, WPE sometimes doesn't return a buffer on request,
leading to a crash. This commit fixes the crash, but not the underlying
failure - a 2nd wpesrc can still error out instead.

Partially fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1386

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1568>
2020-09-21 16:39:57 +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 2caa3e0230 wpe: skip glbasesrc decide_allocation when non-GL caps are negotiated
Checking for GL caps features in gl_start() was done too late in case the parent
class fails to setup a working GL context. The element now determines if GL
support should be enabled during the decide-allocation query handling.

Additionally, when no GL context was found, we need to handle the element
cleanup because in that situation glbasesrc won't call gl_stop.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1532>
2020-08-24 20:59:50 +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 480ede1aa7 wpesrc: timestamp buffers when working with SHM buffers
GLBaseSrc::fill() will take care of that when dealing with
images, but as we don't chain up when dealing with SHM buffers
this needs to be done in order for GLBaseSrc::get_times() to
work appropriately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1476>
2020-07-30 08:09:47 +00:00