mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
wpe: Add a basic WebProcess crash handler
For now an error is emitted. Additional notification could be sent to the application as well, if needed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3077>
This commit is contained in:
parent
01f079f613
commit
ec2330a796
2 changed files with 25 additions and 1 deletions
|
@ -399,7 +399,26 @@ static void s_loadProgressChanged(GObject* object, GParamSpec*, gpointer data)
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void s_webProcessCrashed(WebKitWebView*, WebKitWebProcessTerminationReason reason, gpointer data)
|
||||||
|
{
|
||||||
|
auto &view = *static_cast<WPEView *>(data);
|
||||||
|
auto *src = view.src();
|
||||||
|
gchar *reason_str =
|
||||||
|
g_enum_to_string (WEBKIT_TYPE_WEB_PROCESS_TERMINATION_REASON, reason);
|
||||||
|
|
||||||
|
// In case the crash happened while doing the initial URL loading, unlock
|
||||||
|
// the load completion waiting.
|
||||||
|
view.notifyLoadFinished();
|
||||||
|
|
||||||
|
// TODO: Emit a signal here and fallback to error system if signal wasn't handled by application?
|
||||||
|
|
||||||
|
GST_ELEMENT_ERROR(GST_ELEMENT_CAST(src), RESOURCE, FAILED, (NULL), ("%s", reason_str));
|
||||||
|
|
||||||
|
g_free (reason_str);
|
||||||
|
}
|
||||||
|
|
||||||
WPEView::WPEView(WebKitWebContext* web_context, GstWpeVideoSrc* src, GstGLContext* context, GstGLDisplay* display, int width, int height)
|
WPEView::WPEView(WebKitWebContext* web_context, GstWpeVideoSrc* src, GstGLContext* context, GstGLDisplay* display, int width, int height)
|
||||||
|
: m_src(src)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
{
|
{
|
||||||
|
@ -474,6 +493,7 @@ WPEView::WPEView(WebKitWebContext* web_context, GstWpeVideoSrc* src, GstGLContex
|
||||||
g_signal_connect(webkit.view, "load-failed", G_CALLBACK(s_loadFailed), src);
|
g_signal_connect(webkit.view, "load-failed", G_CALLBACK(s_loadFailed), src);
|
||||||
g_signal_connect(webkit.view, "load-failed-with-tls-errors", G_CALLBACK(s_loadFailedWithTLSErrors), src);
|
g_signal_connect(webkit.view, "load-failed-with-tls-errors", G_CALLBACK(s_loadFailedWithTLSErrors), src);
|
||||||
g_signal_connect(webkit.view, "notify::estimated-load-progress", G_CALLBACK(s_loadProgressChanged), src);
|
g_signal_connect(webkit.view, "notify::estimated-load-progress", G_CALLBACK(s_loadProgressChanged), src);
|
||||||
|
g_signal_connect(webkit.view, "web-process-terminated", G_CALLBACK(s_webProcessCrashed), this);
|
||||||
|
|
||||||
auto* settings = webkit_web_view_get_settings(webkit.view);
|
auto* settings = webkit_web_view_get_settings(webkit.view);
|
||||||
webkit_settings_set_enable_webaudio(settings, TRUE);
|
webkit_settings_set_enable_webaudio(settings, TRUE);
|
||||||
|
|
|
@ -59,6 +59,10 @@ public:
|
||||||
void disconnectLoadFailedSignal();
|
void disconnectLoadFailedSignal();
|
||||||
void waitLoadCompletion();
|
void waitLoadCompletion();
|
||||||
|
|
||||||
|
GstWpeVideoSrc *src() const { return m_src; }
|
||||||
|
|
||||||
|
void notifyLoadFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void handleExportedImage(gpointer);
|
void handleExportedImage(gpointer);
|
||||||
void handleExportedBuffer(struct wpe_fdo_shm_exported_buffer*);
|
void handleExportedBuffer(struct wpe_fdo_shm_exported_buffer*);
|
||||||
|
@ -67,7 +71,6 @@ private:
|
||||||
struct wpe_view_backend* backend() const;
|
struct wpe_view_backend* backend() const;
|
||||||
void frameComplete();
|
void frameComplete();
|
||||||
void loadUriUnlocked(const gchar*);
|
void loadUriUnlocked(const gchar*);
|
||||||
void notifyLoadFinished();
|
|
||||||
|
|
||||||
void releaseImage(gpointer);
|
void releaseImage(gpointer);
|
||||||
void releaseSHMBuffer(gpointer);
|
void releaseSHMBuffer(gpointer);
|
||||||
|
@ -121,6 +124,7 @@ private:
|
||||||
gulong extension_msg_sigid;
|
gulong extension_msg_sigid;
|
||||||
} audio {0, 0};
|
} audio {0, 0};
|
||||||
|
|
||||||
|
GstWpeVideoSrc *m_src { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
class WPEContextThread {
|
class WPEContextThread {
|
||||||
|
|
Loading…
Reference in a new issue