From a14e36fde4235518dca4f65b5ab243046d0bf0cf Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 4 Jan 2022 15:49:35 -0300 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/ext/wpe/gstwpe.h | 1 + .../gst-plugins-bad/ext/wpe/gstwpesrcbin.cpp | 2 +- .../gst-plugins-bad/ext/wpe/gstwpevideosrc.cpp | 4 +++- subprojects/gst-plugins-bad/ext/wpe/meson.build | 2 ++ .../gst-plugins-bad/tests/validate/meson.build | 25 ++++++++++++---------- .../validate/wpe/load_bytes_first.validatetest | 13 +++++++++++ 6 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 subprojects/gst-plugins-bad/tests/validate/wpe/load_bytes_first.validatetest diff --git a/subprojects/gst-plugins-bad/ext/wpe/gstwpe.h b/subprojects/gst-plugins-bad/ext/wpe/gstwpe.h index a997e72..3ff1dc5 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/gstwpe.h +++ b/subprojects/gst-plugins-bad/ext/wpe/gstwpe.h @@ -21,4 +21,5 @@ #include +#define DEFAULT_LOCATION "about:blank" const gchar *gst_wpe_get_devenv_extension_path (void); diff --git a/subprojects/gst-plugins-bad/ext/wpe/gstwpesrcbin.cpp b/subprojects/gst-plugins-bad/ext/wpe/gstwpesrcbin.cpp index 0d5e6d8..ff71eb6 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/gstwpesrcbin.cpp +++ b/subprojects/gst-plugins-bad/ext/wpe/gstwpesrcbin.cpp @@ -500,7 +500,7 @@ gst_wpe_src_class_init (GstWpeSrcClass * klass) gobject_class->finalize = gst_wpe_src_finalize; 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))); g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND, g_param_spec_boolean ("draw-background", "Draws the background", diff --git a/subprojects/gst-plugins-bad/ext/wpe/gstwpevideosrc.cpp b/subprojects/gst-plugins-bad/ext/wpe/gstwpevideosrc.cpp index 3d89f70..c1e452e 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/gstwpevideosrc.cpp +++ b/subprojects/gst-plugins-bad/ext/wpe/gstwpevideosrc.cpp @@ -84,6 +84,7 @@ #include #endif +#include "gstwpe.h" #include "gstwpevideosrc.h" #include #include @@ -752,6 +753,7 @@ static void gst_wpe_video_src_init (GstWpeVideoSrc * src) { src->draw_background = DEFAULT_DRAW_BACKGROUND; + src->location = g_strdup (DEFAULT_LOCATION); 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_param_spec_string ("location", "location", "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_param_spec_boolean ("draw-background", "Draws the background", "Whether to draw the WebView background", DEFAULT_DRAW_BACKGROUND, diff --git a/subprojects/gst-plugins-bad/ext/wpe/meson.build b/subprojects/gst-plugins-bad/ext/wpe/meson.build index 7d7edcf..9dca6c2 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/meson.build +++ b/subprojects/gst-plugins-bad/ext/wpe/meson.build @@ -1,3 +1,4 @@ +building_wpe = false wpe_feat = get_option('wpe').require(gstgl_dep.found(), 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' +building_wpe = true gstwpe = library('gstwpe', ['WPEThreadedView.cpp', 'gstwpe.cpp', 'gstwpevideosrc.cpp', 'gstwpesrcbin.cpp'], dependencies : [egl_dep, wpe_dep, wpe_fdo_dep, gstallocators_dep, gstaudio_dep, gstvideo_dep, diff --git a/subprojects/gst-plugins-bad/tests/validate/meson.build b/subprojects/gst-plugins-bad/tests/validate/meson.build index 12f3d26..3a282a2 100644 --- a/subprojects/gst-plugins-bad/tests/validate/meson.build +++ b/subprojects/gst-plugins-bad/tests/validate/meson.build @@ -4,7 +4,8 @@ if not gst_tester.found() endif tests = [ - 'opencv/cvtracker' + {'path': 'opencv/cvtracker'}, + {'path': 'wpe/load_bytes_first', 'skip': not building_wpe}, ] env = environment() @@ -16,14 +17,16 @@ env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-validate', 'gst-plugin 'gst-plugins-bad@' + meson.project_build_root()) foreach t: tests - test_dir_name = t.split('/') - test_name = 'validate' - foreach c: test_dir_name - test_name += '.' + c - endforeach - test_env = env - test_env.set('GST_VALIDATE_LOGSDIR', join_paths(meson.current_build_dir(), test_name)) - test_file = join_paths(meson.current_source_dir(), t + '.validatetest') - test(test_name, gst_tester, args: [test_file, '--use-fakesinks'], - env: test_env, timeout : 3 * 60, protocol: 'tap') + if not t.get('skip', false) + test_dir_name = t.get('path').split('/') + test_name = 'validate' + foreach c: test_dir_name + test_name += '.' + c + endforeach + test_env = env + test_env.set('GST_VALIDATE_LOGSDIR', join_paths(meson.current_build_dir(), test_name)) + test_file = join_paths(meson.current_source_dir(), t.get('path') + '.validatetest') + test(test_name, gst_tester, args: [test_file, '--use-fakesinks'], + env: test_env, timeout : 3 * 60, protocol: 'tap') + endif endforeach diff --git a/subprojects/gst-plugins-bad/tests/validate/wpe/load_bytes_first.validatetest b/subprojects/gst-plugins-bad/tests/validate/wpe/load_bytes_first.validatetest new file mode 100644 index 0000000..29a39bc --- /dev/null +++ b/subprojects/gst-plugins-bad/tests/validate/wpe/load_bytes_first.validatetest @@ -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=< "

test

", > + +check-last-sample, checksum=8c0eb7a26cf0cb4cb3095a2a6f2d28c97be15874, playback-time=1.0 +stop; -- 2.7.4