webkit2gtk3/fix-gst-crash.patch

67 lines
2.7 KiB
Diff

From: Philippe Normand <philn@igalia.com>
Subject: Fix crash in webkit_media_stream_src_class_init()
Bug: https://bugs.webkit.org/show_bug.cgi?id=254025
Origin: https://github.com/WebKit/WebKit/commit/358ce3a4bd7353c8edaa5720c949301f31c9a5e9
Index: webkitgtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
===================================================================
--- webkitgtk.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ webkitgtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -2647,6 +2647,9 @@ MediaPlayer::SupportsType MediaPlayerPri
#endif
}
+ if (!ensureGStreamerInitialized())
+ return result;
+
GST_DEBUG("Checking mime-type \"%s\"", parameters.type.raw().utf8().data());
if (parameters.type.isEmpty())
return result;
Index: webkitgtk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
===================================================================
--- webkitgtk.orig/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
+++ webkitgtk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
@@ -439,22 +439,13 @@ void MediaPlayerPrivateGStreamerMSE::get
MediaPlayer::SupportsType MediaPlayerPrivateGStreamerMSE::supportsType(const MediaEngineSupportParameters& parameters)
{
- static std::optional<VideoDecodingLimits> videoDecodingLimits;
-#ifdef VIDEO_DECODING_LIMIT
- static std::once_flag onceFlag;
- std::call_once(onceFlag, [] {
- videoDecodingLimits = videoDecoderLimitsDefaults();
- if (!videoDecodingLimits) {
- GST_WARNING("Parsing VIDEO_DECODING_LIMIT failed");
- ASSERT_NOT_REACHED();
- }
- });
-#endif
-
MediaPlayer::SupportsType result = MediaPlayer::SupportsType::IsNotSupported;
if (!parameters.isMediaSource)
return result;
+ if (!ensureGStreamerInitialized())
+ return result;
+
auto containerType = parameters.type.containerType();
// YouTube TV provides empty types for some videos and we want to be selected as best media engine for them.
@@ -476,6 +467,16 @@ MediaPlayer::SupportsType MediaPlayerPri
if (!ok)
height = 0;
+ static std::optional<VideoDecodingLimits> videoDecodingLimits;
+#ifdef VIDEO_DECODING_LIMIT
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ videoDecodingLimits = videoDecoderLimitsDefaults();
+ if (!videoDecodingLimits)
+ GST_WARNING("Parsing VIDEO_DECODING_LIMIT failed");
+ });
+#endif
+
if (videoDecodingLimits && (width > videoDecodingLimits->mediaMaxWidth || height > videoDecodingLimits->mediaMaxHeight))
return result;