Bug 198281 - [WinCairo][MediaFoundation] Crashing while releasing IMFTopology in ~MediaPlayerPrivateMediaFoundation
Summary: [WinCairo][MediaFoundation] Crashing while releasing IMFTopology in ~MediaPla...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 198474
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-27 18:49 PDT by Fujii Hironori
Modified: 2020-07-08 19:18 PDT (History)
0 users

See Also:


Attachments
WIP patch (583 bytes, patch)
2019-05-27 19:15 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP patch (1.42 KB, patch)
2019-05-29 21:27 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP patch (1.74 KB, patch)
2019-05-29 22:20 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
CrashLog_1148_2019-08-05_19-13-09-820.txt (55.21 KB, text/plain)
2019-08-05 03:18 PDT, Fujii Hironori
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2019-05-27 18:49:40 PDT
[WinCairo][MediaFoundation] video/audio elements doesn't work in WebKit2

It works fine in WinCairo WK1.
Comment 1 Fujii Hironori 2019-05-27 19:15:34 PDT
Created attachment 370710 [details]
WIP patch

Page::canStartMedia() always returns false in WK2 MiniBrowser. Do WKViewSetIsInWindow(view, true).

After applying this patch, MFGetService returns 0x80004002 (E_NOINTERFACE) in MediaPlayerPrivateMediaFoundation::updateReadyState in Web process.
Comment 2 Fujii Hironori 2019-05-29 21:27:07 PDT
Created attachment 370919 [details]
WIP patch

(In reply to Fujii Hironori from comment #1)
> After applying this patch, MFGetService returns 0x80004002 (E_NOINTERFACE)
> in MediaPlayerPrivateMediaFoundation::updateReadyState in Web process.

Before that, MediaPlayerPrivateMediaFoundation::createVideoWindow in CreateWindowEx is failing.
Applying this patch, LayoutTests/media/video-resize.html can play back the video.
I need to click invisible play button because the default media control doesn't show. (I guess this will be solve by enable AC.)
But, WK2 can't still play YouTube while WK1 can.
Comment 3 Fujii Hironori 2019-05-29 22:20:24 PDT
Created attachment 370921 [details]
WIP patch

Sometimes observing crashing when destructing MediaPlayerPrivateMediaFoundation.

> oleaut32.dll!00007fff2479bd7b()	Unknown
> oleaut32.dll!00007fff2479c0b1()	Unknown
> combase.dll!00007fff24f53026()	Unknown
> mfcore.dll!00007ffeef5cc3b1()	Unknown
> mfcore.dll!00007ffeef5cc1b4()	Unknown
> mfcore.dll!00007ffeef616e14()	Unknown
> mfcore.dll!00007ffeef6010a7()	Unknown
> mfcore.dll!00007ffeef5c8142()	Unknown
> mfcore.dll!00007ffeef5e5bd6()	Unknown
> mfcore.dll!00007ffeef5e87f4()	Unknown
> mfcore.dll!00007ffeef60e8d0()	Unknown
> WebKit2.dll!COMPtr<IMFTopology>::~COMPtr() Line 63	C++
> WebKit2.dll!WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation() Line 108	C++
> WebKit2.dll!WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation() Line 104	C++
> [External Code]	
> WebKit2.dll!WebCore::MediaPlayer::~MediaPlayer() Line 366	C++
> WebKit2.dll!WebCore::MediaPlayer::~MediaPlayer() Line 364	C++
> WebKit2.dll!WTF::RefCounted<WebCore::MediaPlayer>::deref() Line 145	C++
> WebKit2.dll!WTF::derefIfNotNull<WebCore::MediaPlayer>(WebCore::MediaPlayer * ptr) Line 45	C++
> WebKit2.dll!WTF::RefPtr<WebCore::MediaPlayer,WTF::DumbPtrTraits<WebCore::MediaPlayer> >::operator=(void *) Line 155	C++
> WebKit2.dll!WebCore::HTMLMediaElement::clearMediaPlayer() Line 5659	C++
> WebKit2.dll!WebCore::HTMLMediaElement::userCancelledLoad() Line 5582	C++
> WebKit2.dll!WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer() Line 5710	C++
> WebKit2.dll!WebCore::HTMLMediaElement::stop() Line 5757	C++
> WebKit2.dll!WebCore::ScriptExecutionContext::stopActiveDOMObjects::<unnamed-tag>::operator()<WebCore::ActiveDOMObject>(WebCore::ActiveDOMObject & activeDOMObject) Line 322	C++
> WebKit2.dll!WTF::Detail::CallableWrapper<`lambda at ..\..\Source\WebCore\dom/ScriptExecutionContext.cpp:320:28',WebCore::ScriptExecutionContext::ShouldContinue,WebCore::ActiveDOMObject &>::call(WebCore::ActiveDOMObject & in) Line 52	C++
> WebKit2.dll!WTF::Function<WebCore::ScriptExecutionContext::ShouldContinue (WebCore::ActiveDOMObject &)>::operator()(WebCore::ActiveDOMObject & in) Line 79	C++
> WebKit2.dll!WebCore::ScriptExecutionContext::forEachActiveDOMObject(const WTF::Function<WebCore::ScriptExecutionContext::ShouldContinue (WebCore::ActiveDOMObject &)> & apply) Line 271	C++
> WebKit2.dll!WebCore::ScriptExecutionContext::stopActiveDOMObjects() Line 320	C++
> WebKit2.dll!WebCore::Document::stopActiveDOMObjects() Line 2637	C++
> WebKit2.dll!WebCore::Document::prepareForDestruction() Line 2508	C++
> WebKit2.dll!WebCore::Frame::setView(WTF::RefPtr<WebCore::FrameView,WTF::DumbPtrTraits<WebCore::FrameView> > && view) Line 233	C++
> WebKit2.dll!WebCore::Frame::createView(const WebCore::IntSize & viewportSize, const WTF::Optional<WebCore::Color> & backgroundColor, const WebCore::IntSize & fixedLayoutSize, const WebCore::IntRect & fixedVisibleContentRect, bool useFixedLayout, WebCore::ScrollbarMode horizontalScrollbarMode, bool horizontalLock, WebCore::ScrollbarMode verticalScrollbarMode, bool verticalLock) Line 798	C++
> WebKit2.dll!WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage() Line 1483	C++
> WebKit2.dll!WebCore::FrameLoader::transitionToCommitted(WebCore::CachedPage * cachedPage) Line 2188	C++
> WebKit2.dll!WebCore::FrameLoader::commitProvisionalLoad() Line 2016	C++
> WebKit2.dll!WebCore::DocumentLoader::commitIfReady() Line 368	C++
> WebKit2.dll!WebCore::DocumentLoader::commitLoad(const char * data, int length) Line 997	C++
> WebKit2.dll!WebCore::DocumentLoader::dataReceived(const char * data, int length) Line 1149	C++
> WebKit2.dll!WebCore::DocumentLoader::dataReceived(WebCore::CachedResource & resource, const char * data, int length) Line 1122	C++
> WebKit2.dll!WebCore::CachedRawResource::notifyClientsDataWasReceived(const char * data, unsigned int length) Line 135	C++
> WebKit2.dll!WebCore::CachedRawResource::updateBuffer(WebCore::SharedBuffer & data) Line 74	C++
> WebKit2.dll!WebCore::SubresourceLoader::didReceiveDataOrBuffer(const char * data, int length, WTF::RefPtr<WebCore::SharedBuffer,WTF::DumbPtrTraits<WebCore::SharedBuffer> > && buffer, __int64 encodedDataLength, WebCore::DataPayloadType dataPayloadType) Line 476	C++
> WebKit2.dll!WebCore::SubresourceLoader::didReceiveData(const char * data, unsigned int length, __int64 encodedDataLength, WebCore::DataPayloadType dataPayloadType) Line 444	C++
> WebKit2.dll!WebKit::WebResourceLoader::didReceiveData(const IPC::DataReference & data, __int64 encodedDataLength) Line 155	C++
> WebKit2.dll!IPC::callMemberFunctionImpl<WebKit::WebResourceLoader,void (WebKit::WebResourceLoader::*)(const IPC::DataReference &, long long),std::tuple<IPC::DataReference,long long>,0,1>(WebKit::WebResourceLoader * object, void(WebKit::WebResourceLoader::*)(const IPC::DataReference &, __int64) function, std::tuple<IPC::DataReference,long long> && args, std::integer_sequence<unsigned long long,0,1>) Line 42	C++
> WebKit2.dll!IPC::callMemberFunction<WebKit::WebResourceLoader,void (WebKit::WebResourceLoader::*)(const IPC::DataReference &, long long),std::tuple<IPC::DataReference,long long>,std::integer_sequence<unsigned long long,0,1> >(std::tuple<IPC::DataReference,long long> && args, WebKit::WebResourceLoader * object, void(WebKit::WebResourceLoader::*)(const IPC::DataReference &, __int64) function) Line 47	C++
> WebKit2.dll!IPC::handleMessage<Messages::WebResourceLoader::DidReceiveData,WebKit::WebResourceLoader,void (WebKit::WebResourceLoader::*)(const IPC::DataReference &, long long)>(IPC::Decoder & decoder, WebKit::WebResourceLoader * object, void(WebKit::WebResourceLoader::*)(const IPC::DataReference &, __int64) function) Line 121	C++
> WebKit2.dll!WebKit::WebResourceLoader::didReceiveWebResourceLoaderMessage(IPC::Connection & connection, IPC::Decoder & decoder) Line 61	C++
> WebKit2.dll!WebKit::NetworkProcessConnection::didReceiveMessage(IPC::Connection & connection, IPC::Decoder & decoder) Line 84	C++
> WebKit2.dll!IPC::Connection::dispatchMessage(IPC::Decoder & decoder) Line 984	C++
> WebKit2.dll!IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder,std::default_delete<IPC::Decoder> > message) Line 1012	C++
> WebKit2.dll!IPC::Connection::dispatchOneIncomingMessage() Line 1080	C++
> WebKit2.dll!IPC::Connection::enqueueIncomingMessage::<unnamed-tag>::operator()() Line 962	C++
> WebKit2.dll!WTF::Detail::CallableWrapper<`lambda at ..\..\Source\WebKit\Platform\IPC\Connection.cpp:957:30',void>::call() Line 52	C++
> WTF.dll!WTF::Function<void ()>::operator()() Line 79	C++
> WTF.dll!WTF::RunLoop::performWork() Line 107	C++
> WTF.dll!WTF::RunLoop::wndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 57	C++
> WTF.dll!WTF::RunLoop::RunLoopWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 39	C++
> [External Code]	
> WTF.dll!WTF::RunLoop::run() Line 73	C++
> WebKit2.dll!WebKit::AuxiliaryProcessMain<WebKit::WebProcess,WebKit::WebProcessMain>(int argc, char * * argv) Line 67	C++
> WebKit2.dll!WebKit::WebProcessMainWin(int argc, char * * argv) Line 45	C++
> WebKitWebProcess.exe!main(int argc, char * * argv) Line 33	C++
> [External Code]	

This is becuase IMFTopology is releasing after MFShutdown was called.
I don't know why WK1 doesn't have this issue.
Comment 4 Fujii Hironori 2019-06-10 19:54:01 PDT
(In reply to Fujii Hironori from comment #2)
> Created attachment 370919 [details]
> WIP patch
> 
> (In reply to Fujii Hironori from comment #1)
> > After applying this patch, MFGetService returns 0x80004002 (E_NOINTERFACE)
> > in MediaPlayerPrivateMediaFoundation::updateReadyState in Web process.
> 
> Before that, MediaPlayerPrivateMediaFoundation::createVideoWindow in
> CreateWindowEx is failing.

Fixed in Bug 198523.

Changed the summary of this bug for comment 3 issue.
Comment 5 Fujii Hironori 2019-08-05 03:18:06 PDT
Created attachment 375527 [details]
CrashLog_1148_2019-08-05_19-13-09-820.txt

This crash can be reproduced by some layout tests.
But, they are reported as Timeout. But, crash logs are genereated.

python ./Tools/Scripts/run-webkit-tests --release  --wincairo --no-new-test-results fast/canvas/canvas-createPattern-video-modify.html
Comment 6 Fujii Hironori 2020-07-08 18:45:16 PDT
I don't observe this crash these days.

r248403: crash
r248991: no crash
r249458: no crash
r253320: no crash