From: Philippe Normand Date: Tue, 21 Mar 2023 17:11:48 +0000 (+0000) Subject: Fix crash in webkit_media_stream_src_class_init() X-Git-Tag: archive/raspbian/2.40.0-3+rpi1~1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=753cbc053f8da63eba420dd8d531be9511341a80;p=webkit2gtk.git 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 =================================================================== Gbp-Pq: Name fix-gst-crash.patch --- diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 0ff9f86873..101f3c30bf 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -2647,6 +2647,9 @@ MediaPlayer::SupportsType MediaPlayerPrivateGStreamer::supportsType(const MediaE #endif } + if (!ensureGStreamerInitialized()) + return result; + GST_DEBUG("Checking mime-type \"%s\"", parameters.type.raw().utf8().data()); if (parameters.type.isEmpty()) return result; diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp index 5207235388..97046ce2fb 100644 --- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp @@ -439,22 +439,13 @@ void MediaPlayerPrivateGStreamerMSE::getSupportedTypes(HashSet 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 MediaPlayerPrivateGStreamerMSE::supportsType(const Med if (!ok) height = 0; + static std::optional 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;