wpe: Use about:blank as default URL to support only using load-bytes

WebKit is not going to render anything until a URI is set, leading to a
WPE posting a `WPE View did not render a buffer` error message. To avoid
requiring the user to know it if they only want to use
`wpesrc::load-bytes` we can just use `about:blank` as default and
everything will work as users would expect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1492>
This commit is contained in:
Thibault Saunier 2022-01-04 15:49:35 -03:00 committed by GStreamer Marge Bot
parent 188635b25f
commit a14e36fde4
6 changed files with 34 additions and 13 deletions

View file

@ -21,4 +21,5 @@
#include <gst/gst.h> #include <gst/gst.h>
#define DEFAULT_LOCATION "about:blank"
const gchar *gst_wpe_get_devenv_extension_path (void); const gchar *gst_wpe_get_devenv_extension_path (void);

View file

@ -500,7 +500,7 @@ gst_wpe_src_class_init (GstWpeSrcClass * klass)
gobject_class->finalize = gst_wpe_src_finalize; gobject_class->finalize = gst_wpe_src_finalize;
g_object_class_install_property (gobject_class, PROP_LOCATION, g_object_class_install_property (gobject_class, PROP_LOCATION,
g_param_spec_string ("location", "location", "The URL to display", "", g_param_spec_string ("location", "location", "The URL to display", DEFAULT_LOCATION,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND, g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND,
g_param_spec_boolean ("draw-background", "Draws the background", g_param_spec_boolean ("draw-background", "Draws the background",

View file

@ -84,6 +84,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include "gstwpe.h"
#include "gstwpevideosrc.h" #include "gstwpevideosrc.h"
#include <gst/gl/gl.h> #include <gst/gl/gl.h>
#include <gst/gl/egl/gstglmemoryegl.h> #include <gst/gl/egl/gstglmemoryegl.h>
@ -752,6 +753,7 @@ static void
gst_wpe_video_src_init (GstWpeVideoSrc * src) gst_wpe_video_src_init (GstWpeVideoSrc * src)
{ {
src->draw_background = DEFAULT_DRAW_BACKGROUND; src->draw_background = DEFAULT_DRAW_BACKGROUND;
src->location = g_strdup (DEFAULT_LOCATION);
gst_base_src_set_live (GST_BASE_SRC_CAST (src), TRUE); gst_base_src_set_live (GST_BASE_SRC_CAST (src), TRUE);
@ -789,7 +791,7 @@ gst_wpe_video_src_class_init (GstWpeVideoSrcClass * klass)
g_object_class_install_property (gobject_class, PROP_LOCATION, g_object_class_install_property (gobject_class, PROP_LOCATION,
g_param_spec_string ("location", "location", g_param_spec_string ("location", "location",
"The URL to display", "The URL to display",
"", (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_LOCATION, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND, g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND,
g_param_spec_boolean ("draw-background", "Draws the background", g_param_spec_boolean ("draw-background", "Draws the background",
"Whether to draw the WebView background", DEFAULT_DRAW_BACKGROUND, "Whether to draw the WebView background", DEFAULT_DRAW_BACKGROUND,

View file

@ -1,3 +1,4 @@
building_wpe = false
wpe_feat = get_option('wpe').require(gstgl_dep.found(), wpe_feat = get_option('wpe').require(gstgl_dep.found(),
error_message : 'wpe plugin enabled but GL support was not detected') error_message : 'wpe plugin enabled but GL support was not detected')
@ -22,6 +23,7 @@ giounix_dep = dependency('gio-unix-2.0', required: false)
wpe_extension_install_dir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'wpe-extension' wpe_extension_install_dir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'wpe-extension'
building_wpe = true
gstwpe = library('gstwpe', gstwpe = library('gstwpe',
['WPEThreadedView.cpp', 'gstwpe.cpp', 'gstwpevideosrc.cpp', 'gstwpesrcbin.cpp'], ['WPEThreadedView.cpp', 'gstwpe.cpp', 'gstwpevideosrc.cpp', 'gstwpesrcbin.cpp'],
dependencies : [egl_dep, wpe_dep, wpe_fdo_dep, gstallocators_dep, gstaudio_dep, gstvideo_dep, dependencies : [egl_dep, wpe_dep, wpe_fdo_dep, gstallocators_dep, gstaudio_dep, gstvideo_dep,

View file

@ -4,7 +4,8 @@ if not gst_tester.found()
endif endif
tests = [ tests = [
'opencv/cvtracker' {'path': 'opencv/cvtracker'},
{'path': 'wpe/load_bytes_first', 'skip': not building_wpe},
] ]
env = environment() env = environment()
@ -16,14 +17,16 @@ env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-validate', 'gst-plugin
'gst-plugins-bad@' + meson.project_build_root()) 'gst-plugins-bad@' + meson.project_build_root())
foreach t: tests foreach t: tests
test_dir_name = t.split('/') if not t.get('skip', false)
test_name = 'validate' test_dir_name = t.get('path').split('/')
foreach c: test_dir_name test_name = 'validate'
test_name += '.' + c foreach c: test_dir_name
endforeach test_name += '.' + c
test_env = env endforeach
test_env.set('GST_VALIDATE_LOGSDIR', join_paths(meson.current_build_dir(), test_name)) test_env = env
test_file = join_paths(meson.current_source_dir(), t + '.validatetest') test_env.set('GST_VALIDATE_LOGSDIR', join_paths(meson.current_build_dir(), test_name))
test(test_name, gst_tester, args: [test_file, '--use-fakesinks'], test_file = join_paths(meson.current_source_dir(), t.get('path') + '.validatetest')
env: test_env, timeout : 3 * 60, protocol: 'tap') test(test_name, gst_tester, args: [test_file, '--use-fakesinks'],
env: test_env, timeout : 3 * 60, protocol: 'tap')
endif
endforeach endforeach

View file

@ -0,0 +1,13 @@
meta,
args = {
"wpesrc name=wpesrc ! queue ! video/x-raw,width=480,height=270 ! fakesink name=sink",
}
check-last-sample, checksum=e16c8ac11b4ad92e26abab2743d609f4c3ac2e37, playback-time=0.1
emit-signal,
signal-name="load-bytes",
target-element-name="wpesrc",
params=< "<h1>test<h1>", >
check-last-sample, checksum=8c0eb7a26cf0cb4cb3095a2a6f2d28c97be15874, playback-time=1.0
stop;