Skip to content

Conversation

@asurdej-comcast
Copy link

@asurdej-comcast asurdej-comcast commented Nov 21, 2025

GStreamerQuirksManager verifies each quirk with isPlatformSupported() that usually relies on gst elements presense in the registry. Calling this without gst_init called fails for every gst element and rejects all quirks.

The problem exists for apps that don't use any of canPlayType() or isTypeSupported() that handle gst_init internally

More details in #1583
cfa5698

Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ✅ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ✅ 🧪 wpe-246-arm32-layout

GStreamerQuirksManager verifies each quirk with isPlatformSupported()
that usually relies on gst elements presense in the registry.
Calling this without gst_init called fails for every gst element
and rejects all quirks.

The problem exists for apps that don't use any of canPlayType()
or isTypeSupported() that handle gst_init internally
@asurdej-comcast asurdej-comcast changed the title [GST]Ensure GST initialized before playing with GST Quirks [2.46][GST]Ensure GST initialized before playing with GST Quirks Nov 21, 2025
vivienne-w added a commit to vivienne-w/WebKit that referenced this pull request Dec 1, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by NOBODY (OOPS!).

GStreamerQuirksManager verifies each quirk with isPlatformSupported()
that usually relies on gst elements presense in the registry.
Calling this without gst_init called fails for every gst element and
rejects all quirks.

The problem exists for apps that don't use any of canPlayType() or
isTypeSupported() that handle gst_init internally.

* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):

Original author: Andrzej Surdej <[email protected]>
See: WebPlatformForEmbedded/WPEWebKit#1584
@vivienne-w vivienne-w added the upstream Related to an upstream bug (or should be at some point) label Dec 1, 2025
@vivienne-w vivienne-w self-assigned this Dec 1, 2025
vivienne-w added a commit to vivienne-w/WebKit that referenced this pull request Dec 2, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by NOBODY (OOPS!).

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>
See: WebPlatformForEmbedded/WPEWebKit#1584
vivienne-w added a commit to vivienne-w/WebKit that referenced this pull request Dec 4, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by NOBODY (OOPS!).

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>
See: WebPlatformForEmbedded/WPEWebKit#1584
webkit-commit-queue pushed a commit to vivienne-w/WebKit that referenced this pull request Dec 5, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by Philippe Normand.

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>

See: WebPlatformForEmbedded/WPEWebKit#1584
Canonical link: https://commits.webkit.org/303982@main
vivienne-w added a commit that referenced this pull request Dec 8, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by Philippe Normand.

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>

See: #1584
Canonical link: https://commits.webkit.org/303982@main
vivienne-w added a commit that referenced this pull request Dec 8, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by Philippe Normand.

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>

See: #1584
Canonical link: https://commits.webkit.org/303982@main
@vivienne-w
Copy link

This patch introduced crashes in NetworkProcess, which may also use the QuirksManager, because ensureGStreamerInitialized() is only meant for the WebProcess. To solve this I've added an equivalent function for other processes, which just does a minimal initialization of GStreamer.

Anyways, this is tracked upstream as https://bugs.webkit.org/show_bug.cgi?id=303326 and landed as WebKit/WebKit@5034d71. I've backported this to 2.46 as dd19f4d and 2.38 as 4bdbd3c.

@asurdej-comcast
Copy link
Author

@vivienne-w Thank you for your help. Could you please provide some more details on the network process crash with my patch? We haven't found that crash while testing on our side and I'm wondering if we missed something

aperezdc pushed a commit to WebKit/WebKit that referenced this pull request Dec 8, 2025
…gi?id=303326

    [GStreamer] Ensure GStreamer is initialized before using the Quirks
    https://bugs.webkit.org/show_bug.cgi?id=303326

    Reviewed by Philippe Normand.

    GStreamerQuirksManager requires GStreamer to be initialized, which
    does not happen soon enough if neither canPlayType() nor isTypeSupported() has
    been called before, so in those cases no quirks are applied.

    However, the quirks manager may be used in other processes, e.g. NetworkProcess
    when determining support for a MIME type. To avoid issues, we should
    only fully init GStreamer if on the WebProcess, and otherwise go for
    a minimal initialization.

    * Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
    (WebCore::ensureGStreamerInitializedNonWebProcess):
    Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
    * Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
    * Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
    (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
    Use the new function to initialize gst if in the UIProcess
    * Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
    (WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
    Init GStreamer using either of the two methods

    Original author: Andrzej Surdej <[email protected]>

    See: WebPlatformForEmbedded/WPEWebKit#1584
    Canonical link: https://commits.webkit.org/303982@main

Canonical link: https://commits.webkit.org/298234.313@webkitglib/2.50
@emutavchi
Copy link
Collaborator

@vivienne-w I get a WebProcess crash introduced with dd19f4d,

at

bool ensureGStreamerInitializedNonWebProcess()
{
>>>    RELEASE_ASSERT(!isInWebProcess());
...
}

Could you please check?

crash backtrace:

Thread 42 "WebKitWebRTCSig" received signal SIGABRT, Aborted.
[Switching to Thread 26329.27244]
__libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
47      in ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S
(gdb) bt
#0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
#1  0xf3dde13c in __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=<optimized out>) at pthread_kill.c:43
#2  0xf3dafb86 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0xf3da15d4 in __GI_abort () at abort.c:79
#4  0xf662a9f2 in WTFCrashWithInfo () at WTF/Headers/wtf/Assertions.h:931
#5  WebCore::ensureGStreamerInitializedNonWebProcess () at ../git/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:352
#6  0xf66afb78 in operator() (__closure=<optimized out>) at ../git/Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:64
#7  std::__invoke_impl<void, WebCore::GStreamerQuirksManager::GStreamerQuirksManager(bool, bool)::<lambda()> > (__f=...) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/bits/invoke.h:61
#8  std::__invoke<WebCore::GStreamerQuirksManager::GStreamerQuirksManager(bool, bool)::<lambda()> > (__fn=...) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/bits/invoke.h:96
#9  operator() (__closure=<optimized out>) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/mutex:776
#10 operator() (__closure=0x0) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/mutex:712
#11 _FUN () at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/mutex:712
#12 0xf3de0678 in __pthread_once_slow (once_control=0xf75b0c14 <WebCore::GStreamerQuirksManager::GStreamerQuirksManager(bool, bool)::debugRegisteredFlag>, init_routine=0xf2b95cb5 <std::__once_proxy()>)
    at pthread_once.c:116
#13 0xf66b13dc in __gthread_once (__func=<optimized out>, __once=0xf75b0c14 <WebCore::GStreamerQuirksManager::GStreamerQuirksManager(bool, bool)::debugRegisteredFlag>)
    at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/arm-rdkmllib32-linux-gnueabi/bits/gthr-default.h:700
#14 std::call_once<WebCore::GStreamerQuirksManager::GStreamerQuirksManager(bool, bool)::<lambda()> > (__once=..., __f=...) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/mutex:783
#15 WebCore::GStreamerQuirksManager::GStreamerQuirksManager (this=0xf75b0bfc <WebCore::GStreamerQuirksManager::singleton()::sharedInstance>, isForTesting=<optimized out>,
    loadQuirksFromEnvironment=<optimized out>) at ../git/Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:59
#16 0xf66b1d42 in WTF::NeverDestroyed<WebCore::GStreamerQuirksManager, WTF::AnyThreadsAccessTraits>::NeverDestroyed<bool, bool> (this=0xf75b0bfc <WebCore::GStreamerQuirksManager::singleton()::sharedInstance>)
    at ../git/Source/WebCore/platform/gstreamer/GStreamerQuirks.h:123
#17 WebCore::GStreamerQuirksManager::singleton () at ../git/Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:51
#18 0xf662c7a2 in WebCore::GStreamerRegistryScanner::ElementFactories::ElementFactories (this=0xb94fd45c, types=...) at ../git/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:151
#19 0xf6635bca in WebCore::GStreamerRegistryScanner::refresh (this=this@entry=0xf75b0820 <WebCore::GStreamerRegistryScanner::singleton()::sharedInstance>)
    at ../git/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:380
#20 0xf6635fde in WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner (this=0xf75b0820 <WebCore::GStreamerRegistryScanner::singleton()::sharedInstance>, isMediaSource=<optimized out>)
    at ../git/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:370
#21 0xf6636038 in WTF::NeverDestroyed<WebCore::GStreamerRegistryScanner, WTF::AnyThreadsAccessTraits>::NeverDestroyed<>() (this=0xf75b0820 <WebCore::GStreamerRegistryScanner::singleton()::sharedInstance>)
    at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/new:175
#22 WebCore::GStreamerRegistryScanner::singleton () at ../git/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:127
#23 0xf66f4be8 in WebCore::GStreamerWebRTCVideoDecoder::GstDecoderFactory (capsStr=0xf42a6fc0 "video/x-vp8")
    at ../git/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:278
#24 WebCore::GStreamerWebRTCVideoDecoder::HasGstDecoder (this=0xb94fd504) at ../git/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:283
#25 WebCore::GStreamerWebRTCVideoDecoder::AddDecoderIfSupported (codecList=std::vector of length 0, capacity 0, this=0xb94fd504)
    at ../git/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:265
#26 WebCore::GStreamerVideoDecoderFactory::GetSupportedFormats (this=0xec50c7b0) at ../git/Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoDecoderFactory.cpp:430
#27 0xf6bd22ca in cricket::(anonymous namespace)::GetDefaultSupportedFormats<webrtc::VideoDecoderFactory> (factory=<optimized out>, trials=..., is_decoder_factory=true)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtc_video_engine.cc:180
#28 0xf6bd451a in cricket::(anonymous namespace)::GetPayloadTypesAndDefaultCodecs<webrtc::VideoDecoderFactory> (is_decoder_factory=true, trials=..., include_rtx=true, factory=<optimized out>)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtc_video_engine.cc:284
#29 cricket::WebRtcVideoEngine::recv_codecs (this=<optimized out>, include_rtx=<optimized out>) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtc_video_engine.cc:824
#30 0xf6d9536c in cricket::MediaSessionDescriptionFactory::MediaSessionDescriptionFactory (this=this@entry=0xe4188b58, media_engine=<optimized out>, rtx_enabled=<optimized out>,
    ssrc_generator=ssrc_generator@entry=0xe4114838, transport_desc_factory=transport_desc_factory@entry=0xe4188b4c) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/media_session.cc:1364
#31 0xf6dede7a in webrtc::WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory (this=this@entry=0xe4188b20, context=context@entry=0xe4114800, sdp_info=sdp_info@entry=0xe4188760,
    session_id="7419831579601673682", dtls_enabled=true, cert_generator=std::unique_ptr<rtc::RTCCertificateGeneratorInterface> = {...}, certificate=..., on_certificate_ready=..., field_trials=...)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/webrtc_session_description_factory.cc:114
#32 0xf6d795a8 in std::make_unique<webrtc::WebRtcSessionDescriptionFactory, webrtc::ConnectionContext*&, webrtc::SdpOfferAnswerHandler*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, std::unique_ptr<rtc::RTCCertificateGeneratorInterface, std::default_delete<rtc::RTCCertificateGeneratorInterface> >, webrtc::scoped_refptr<rtc::RTCCertificate>, webrtc::SdpOfferAnswerHandler::Initialize(const webrtc::PeerConnectionInterface::RTCConfiguration&, webrtc::PeerConnectionDependencies&, webrtc::ConnectionContext*)::<lambda(rtc::scoped_refptr<rtc::RTCCertificate>&)>, const webrtc::FieldTrialsView&> () at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/bits/unique_ptr.h:962
#33 webrtc::SdpOfferAnswerHandler::Initialize (this=this@entry=0xe4188760, configuration=..., dependencies=..., context=context@entry=0xe4114800)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/sdp_offer_answer.cc:1417
#34 0xf6d79908 in webrtc::SdpOfferAnswerHandler::Create (pc=pc@entry=0xe4188354, configuration=..., dependencies=..., context=0xe4114800)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/sdp_offer_answer.cc:1384
#35 0xf6d15a26 in webrtc::PeerConnection::Initialize (this=this@entry=0xe4188350, configuration=..., dependencies=...) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/api/scoped_refptr.h:106
#36 0xf6d1728c in webrtc::PeerConnection::Create (env=..., context=..., options=..., call=std::unique_ptr<webrtc::Call> = {...}, configuration=..., dependencies=...)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection.cc:568
#37 0xf6ce42c4 in webrtc::PeerConnectionFactory::CreatePeerConnectionOrError (this=0xe41265c8, configuration=..., dependencies=...)
    at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peer_connection_factory.cc:265
#38 0xf66f6512 in webrtc::ReturnType<webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> > >::Invoke<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> > (webrtc::PeerConnectionFactoryInterface::*)(webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies), webrtc::PeerConnectionInterface::RTCConfiguration const, webrtc::PeerConnectionDependencies> (this=0xffdb2d9c, c=<optimized out>, m=&virtual table offset 20) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/proxy.h:86
#39 0xf66f675a in webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Invoke<0u, 1u> (this=<optimized out>) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/proxy.h:131
#40 webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}::operator()() const (__closure=0xb94fdb98) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/pc/proxy.h:120
#41 std::__invoke_impl<void, webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}>(std::__invoke_other, webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}&&) (__f=...)
    at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/bits/invoke.h:61
#42 std::__invoke<webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}>(webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >,webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}&&) (__fn=...)
    at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/bits/invoke.h:96
#43 std::invoke<webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}>(webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}&&) (__fn=...) at ../lib32-recipe-sysroot/usr/include/c++/11.3.0/functional:97
#44 absl::internal_any_invocable::InvokeR<void, webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}, , void>(webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}&&) (f=...)
    at ../git/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/absl/functional/internal/any_invocable.h:132
#45 absl::internal_any_invocable::LocalInvoker<false, void, webrtc::MethodCall<webrtc::PeerConnectionFactoryInterface, webrtc::RTCErrorOr<webrtc::scoped_refptr<webrtc::PeerConnectionInterface> >, webrtc::PeerConnectionInterface::RTCConfiguration const&, webrtc::PeerConnectionDependencies>::Marshal(rtc::Thread*)::{lambda()#1}&&>(absl::internal_any_invocable::TypeErasedState*) (state=0xb94fdb98)
    at ../git/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/absl/functional/internal/any_invocable.h:310
#46 0xf6e487da in absl::internal_any_invocable::Impl<void () &&>::operator()() && (this=0xb94fdb98)
    at ../git/Source/ThirdParty/libwebrtc/Source/third_party/abseil-cpp/absl/functional/internal/any_invocable.h:876
#47 rtc::Thread::Dispatch(absl::AnyInvocable<void () &&>) (this=this@entry=0xff0468, task=...) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/thread.cc:525
#48 0xf6e489ca in rtc::Thread::ProcessMessages (this=this@entry=0xff0468, cmsLoop=cmsLoop@entry=-1) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/thread.cc:851
#49 0xf6e48a26 in rtc::Thread::Run (this=0xff0468) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/thread.cc:713
#50 rtc::Thread::PreRun (pv=0xff0468) at ../git/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/thread.cc:702
#51 0xf3ddcace in start_thread (arg=0x9cccab0a) at pthread_create.c:442
#52 0xf3e2d070 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:74 from ./lib/libc.so.6

@modeveci modeveci reopened this Dec 11, 2025
@modeveci
Copy link

@vivienne-w , can you please look at this feedback? Thank you!

@vivienne-w
Copy link

@modeveci Taking a look

@vivienne-w
Copy link

I'll revert my commit for now, and introduce another one closer to this, just with an extra check to prevent initializing gst in networkprocess

@asurdej-comcast I've attached a backtrace from the networkprocess crash in this bug: https://bugs.webkit.org/show_bug.cgi?id=303538

To summarize, QuirkManager may be used from the NetworkProcess when querying MIME type support, and so ensureGStreamerInitialized() would crash since it asserts that it is in the web process

@emutavchi
Copy link
Collaborator

@vivienne-w I've drafted a potential fix here: #1589

as it turns out, wpe-2.46 has both WTF and WebCore runtime application checks. WTF doesn't seem to be used much.

@asurdej-comcast
Copy link
Author

Thanks @vivienne-w , it makes sense now why we don't see that crash.

The backtrace that you shared is taken from upstream WebKit. I see there was a recent change for didGetFileInfo() func that calls canShowMIMEType() which requires quirks
WebKit/WebKit@08c24be#diff-929313c9451ea7317fe6a52d5f665c40cc96ff8bf02967313357bef357d1b6d1R1439

That change is not part of 2.46, let alone 2.38.
We are safe then with 2.38 at least as we've already released the original change from this PR.

vivienne-w added a commit that referenced this pull request Dec 11, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by Philippe Normand.

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>

See: #1584
Canonical link: https://commits.webkit.org/303982@main
vivienne-w added a commit that referenced this pull request Dec 11, 2025
https://bugs.webkit.org/show_bug.cgi?id=303326

Reviewed by Philippe Normand.

GStreamerQuirksManager requires GStreamer to be initialized, which
does not happen soon enough if neither canPlayType() nor isTypeSupported() has
been called before, so in those cases no quirks are applied.

However, the quirks manager may be used in other processes, e.g. NetworkProcess
when determining support for a MIME type. To avoid issues, we should
only fully init GStreamer if on the WebProcess, and otherwise go for
a minimal initialization.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitializedNonWebProcess):
Added as a counterpart to ensureGStreamerInitialized, only does minimal init.
* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner):
Use the new function to initialize gst if in the UIProcess
* Source/WebCore/platform/gstreamer/GStreamerQuirks.cpp:
(WebCore::GStreamerQuirksManager::GStreamerQuirksManager):
Init GStreamer using either of the two methods

Original author: Andrzej Surdej <[email protected]>

See: #1584
Canonical link: https://commits.webkit.org/303982@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to an upstream bug (or should be at some point) wpe-2.46

Development

Successfully merging this pull request may close these issues.

4 participants