Bug 169811

Summary: [GTK] Add support for canvas captureStream, tests failing since they were added in r213598
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: alex, bugs-noreply, cturner, Hironori.Fujii, mcatanzaro, pnormand, talltyler, tsaunier, youennf
Priority: P2 Keywords: Gtk, LayoutTestFailure
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=172954

Description Carlos Garcia Campos 2017-03-17 02:39:10 PDT
fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Crash ]
  fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Crash ]
  fast/mediastream/captureStream/canvas2d-heavy-drawing.html [ Crash ]
  fast/mediastream/captureStream/canvas2d.html [ Crash ]
Comment 1 youenn fablet 2017-04-04 16:34:52 PDT
Would be cool if GTK would support that.
The port work might be limited to updating Source/WebCore/platform/graphics/ImageBuffer.cpp as done in r213598 for the Mac platform.
Comment 2 Alejandro G. Castro 2017-06-07 06:17:43 PDT
*** Bug 172954 has been marked as a duplicate of this bug. ***
Comment 3 Michael Catanzaro 2017-06-07 07:34:16 PDT
So unimplemented web-exposed WebRTC features cause web process crashes instead of JS-level failures?
Comment 4 Alejandro G. Castro 2017-06-07 23:43:44 PDT
(In reply to Michael Catanzaro from comment #3)
> So unimplemented web-exposed WebRTC features cause web process crashes
> instead of JS-level failures?

In this case it is what is happening, you can read my comment in the other bug to understand it:

https://bugs.webkit.org/show_bug.cgi?id=172954#c4

Anyway, this is an API from a different spec that defines mediaCapture of DOM elements such as canvas that can be consumed by WebRTC or WebAudio, check the spec here:

https://w3c.github.io/mediacapture-fromelement/#

If we do not have time to check it before the next release we need to guard it with something different than MEDIA_STREAM.
Comment 5 Fujii Hironori 2017-06-19 02:56:17 PDT
(In reply to Carlos Garcia Campos from comment #0)
>   fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Crash ]
>   fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Crash ]

This doesn't crash now.

>   fast/mediastream/captureStream/canvas2d-heavy-drawing.html [ Crash ]
>   fast/mediastream/captureStream/canvas2d.html [ Crash ]

Still crashes.

> STDERR: warning: core file may not match specified executable file.
> STDERR: 58	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> STDERR: g_object_get: assertion 'G_IS_OBJECT (object)' failed

Callstack:

> Thread 1 (Thread 0x7ffff7f25040 (LWP 72572)):
> #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
> #1  0x00007fffeb8ee37a in __GI_abort () at abort.c:89
> #2  0x00007fffeb930090 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7fffeba4396c "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:175
> #3  0x00007fffeb9d1384 in __GI___fortify_fail (msg=<optimized out>, msg@entry=0x7fffeba4394e "stack smashing detected") at fortify_fail.c:37
> #4  0x00007fffeb9d1330 in __stack_chk_fail () at stack_chk_fail.c:28
> #5  0x0000555556e71612 in WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded(WebCore::MediaStreamTrackPrivate&) ()
> #6  0x000055555694f500 in WebCore::MediaStreamTrackPrivate::endTrack() ()
> #7  0x0000555555f3a42b in WebCore::MediaStreamTrack::stopTrack(WebCore::MediaStreamTrack::StopMode) ()
> #8  0x0000555555f3a45e in WebCore::MediaStreamTrack::stop() ()
> #9  0x00005555562fa33b in WebCore::ScriptExecutionContext::stopActiveDOMObjects() ()
> #10 0x000055555627ef80 in WebCore::Document::stopActiveDOMObjects() ()
> #11 0x000055555627f087 in WebCore::Document::prepareForDestruction() ()
> #12 0x000055555676c1d2 in WebCore::Frame::setView(WTF::RefPtr<WebCore::FrameView>&&) ()
> #13 0x000055555676efbc in WebCore::Frame::createView(WebCore::IntSize const&, WebCore::Color const&, bool, WebCore::IntSize const&, WebCore::IntRect const&, bool, WebCore::ScrollbarMode, bool, WebCore::ScrollbarMode, bool) ()
> #14 0x00007ffff578c62b in WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage() () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #15 0x00005555566357ca in WebCore::FrameLoader::transitionToCommitted(WebCore::CachedPage*) ()
> #16 0x0000555556635913 in WebCore::FrameLoader::commitProvisionalLoad() ()
> #17 0x000055555660ed17 in WebCore::DocumentLoader::finishedLoading() ()
> #18 0x000055555660f309 in WebCore::DocumentLoader::maybeLoadEmpty() ()
> #19 0x0000555556612362 in WebCore::DocumentLoader::startLoadingMainResource() ()
> #20 0x0000555556636348 in WebCore::FrameLoader::continueLoadAfterNavigationPolicy(WebCore::ResourceRequest const&, WebCore::FormState*, bool, WebCore::AllowNavigationToInvalidURL) ()
> #21 0x000055555666306b in WebCore::PolicyCallback::call(bool) ()
> #22 0x000055555666c020 in WebCore::PolicyChecker::continueAfterNavigationPolicy(WebCore::PolicyAction) ()
> #23 0x00007ffff5794a81 in WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(WebCore::NavigationAction const&, WebCore::ResourceRequest const&, WebCore::FormState*, std::function<void (WebCore::PolicyAction)>) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #24 0x000055555666b00d in WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&, bool, WebCore::DocumentLoader*, WebCore::FormState*, WTF::Function<void (WebCore::ResourceRequest const&, WebCore::FormState*, bool)>) ()
> #25 0x0000555556636752 in WebCore::FrameLoader::loadWithDocumentLoader(WebCore::DocumentLoader*, WebCore::FrameLoadType, WebCore::FormState*, WebCore::AllowNavigationToInvalidURL) ()
> #26 0x0000555556639392 in WebCore::FrameLoader::load(WebCore::FrameLoadRequest const&) ()
> #27 0x00007ffff57c21f8 in WebKit::WebPage::loadRequest(WebKit::LoadParameters const&) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #28 0x00007ffff59aad97 in void IPC::handleMessage<Messages::WebPage::LoadAlternateHTMLString, WebKit::WebPage, void (WebKit::WebPage::*)(WebKit::LoadParameters const&)>(IPC::Decoder&, WebKit::WebPage*, void (WebKit::WebPage::*)(WebKit::LoadParameters const&)) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #29 0x00007ffff59a88b9 in WebKit::WebPage::didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #30 0x00007ffff558f2e9 in IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #31 0x00007ffff56ffd36 in WebKit::WebProcess::didReceiveMessage(IPC::Connection&, IPC::Decoder&) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #32 0x00007ffff558ab3b in IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #33 0x00007ffff558bb28 in IPC::Connection::dispatchOneMessage() () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #34 0x00007ffff3bc017d in WTF::RunLoop::performWork() () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
> #35 0x00007ffff3bf7249 in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
> #36 0x00007fffeeea96ea in g_main_dispatch () at /home/fujii/work/webkit/ga/WebKitBuild/DependenciesGTK/Source/glib-2.52.1/glib/gmain.c:3212
> #37 g_main_context_dispatch () at /home/fujii/work/webkit/ga/WebKitBuild/DependenciesGTK/Source/glib-2.52.1/glib/gmain.c:3865
> #38 0x00007fffeeea9aa0 in g_main_context_iterate () at /home/fujii/work/webkit/ga/WebKitBuild/DependenciesGTK/Source/glib-2.52.1/glib/gmain.c:3938
> #39 0x00007fffeeea9dc2 in g_main_loop_run () at /home/fujii/work/webkit/ga/WebKitBuild/DependenciesGTK/Source/glib-2.52.1/glib/gmain.c:4134
> #40 0x00007ffff3bf7c70 in WTF::RunLoop::run() () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
> #41 0x00007ffff5952a2a in int WebKit::ChildProcessMain<WebKit::WebProcess, WebKit::WebProcessMain>(int, char**) () from /home/fujii/work/webkit/ga/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
> #42 0x00007fffeb8d73f1 in __libc_start_main (main=0x555555e2c5a0 <main>, argc=2, argv=0x7fffffffdca8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdc98) at ../csu/libc-start.c:291
> #43 0x0000555555e2caea in _start ()
Comment 6 Charlie Turner 2017-08-22 11:20:54 PDT
The stderr above seems like an environmental issues clopez?

fast/mediastream/captureStream/canvas2d-heavy-drawing.html [ Crash ]
fast/mediastream/captureStream/canvas2d.html [ Crash ]

These are now flaky tests. heavy-drawing for example gave me this on stderr,

invalid uninstantiatable type '(null)' in cast to 'OwrMediaSource'
owr_media_renderer_set_source: assertion '!source || OWR_IS_MEDIA_SOURCE(source)' failed

Shouldn't everything under fast/mediastream be skipped, since we don't support it IIUC?
Comment 7 Alejandro G. Castro 2017-08-22 22:47:24 PDT
(In reply to Charlie Turner from comment #6)
> The stderr above seems like an environmental issues clopez?
> 
> fast/mediastream/captureStream/canvas2d-heavy-drawing.html [ Crash ]
> fast/mediastream/captureStream/canvas2d.html [ Crash ]
> 
> These are now flaky tests. heavy-drawing for example gave me this on stderr,
> 
> invalid uninstantiatable type '(null)' in cast to 'OwrMediaSource'
> owr_media_renderer_set_source: assertion '!source ||
> OWR_IS_MEDIA_SOURCE(source)' failed
> 
> Shouldn't everything under fast/mediastream be skipped, since we don't
> support it IIUC?

We support mediastream but we do not support captureStream for the moment.
Comment 8 Charlie Turner 2017-08-23 01:57:42 PDT
Yes, sorry I missed the "captureStream" of the path there.
Comment 9 Philippe Normand 2018-02-09 09:33:07 PST
I suppose this will work with the libwebrtc backend?
Comment 10 Thibault Saunier 2018-04-03 09:46:13 PDT
(In reply to Philippe Normand from comment #9)
> I suppose this will work with the libwebrtc backend?

Not really, we are still missing something for the CaptureStream API.
Comment 11 Tyler Larson 2019-10-02 15:06:46 PDT
Can we get an update on the status of this feature? And while we wait is there any other supported way to capture the canvas that currently works in iOS?