Bug 210926 - [GStreamer][Pipewire] Implement getDisplayMedia() backend
Summary: [GStreamer][Pipewire] Implement getDisplayMedia() backend
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
: 191007 (view as bug list)
Depends on:
Blocks: 227902
  Show dependency treegraph
 
Reported: 2020-04-23 11:37 PDT by Diego Pino
Modified: 2021-08-16 04:17 PDT (History)
22 users (show)

See Also:


Attachments
Patch (100.77 KB, patch)
2021-07-11 10:08 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (50.78 KB, patch)
2021-07-13 05:02 PDT, Philippe Normand
calvaris: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2020-04-23 11:37:30 PDT
fast/mediastream/getDisplayMedia-max-constraints.html [ Crash ]
  fast/mediastream/getDisplayMedia-max-constraints1.html [ Crash ]
  fast/mediastream/getDisplayMedia-max-constraints2.html [ Crash ]
  fast/mediastream/getDisplayMedia-max-constraints3.html [ Crash ]

See: https://build.webkit.org/results/GTK%20Linux%2064-bit%20Release%20(Tests)/r260563%20(13450)/fast/mediastream/getDisplayMedia-max-constraints-crash-log.txt

Thread 1 (Thread 0x7f8f6a9ce9c0 (LWP 13157)):
#0  0x00007f8f72dfa8be in WTFCrash () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#1  0x00007f8f74f42ccf in WebCore::MockCameraProperties& WTF::__throw_bad_variant_access<WebCore::MockCameraProperties&>(char const*) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#2  0x00007f8f767be962 in WebCore::MockRealtimeVideoSource::generatePresets() () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#3  0x00007f8f767ad1b7 in WebCore::RealtimeVideoCaptureSource::presets() () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#4  0x00007f8f76dcbd20 in WebCore::MockGStreamerVideoCaptureSource::generatePresets() () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#5  0x00007f8f767ad1b7 in WebCore::RealtimeVideoCaptureSource::presets() () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#6  0x00007f8f767b01e7 in WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate(WTF::Optional<int>, WTF::Optional<int>, WTF::Optional<double>) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#7  0x00007f8f767b0aa8 in WebCore::RealtimeVideoCaptureSource::supportsSizeAndFrameRate(WTF::Optional<int>, WTF::Optional<int>, WTF::Optional<double>) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#8  0x00007f8f767a019e in WebCore::RealtimeMediaSource::supportsSizeAndFrameRate(WTF::Optional<WebCore::IntConstraint>, WTF::Optional<WebCore::IntConstraint>, WTF::Optional<WebCore::DoubleConstraint>, WTF::String&, double&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#9  0x00007f8f767a3429 in WebCore::RealtimeMediaSource::selectSettings(WebCore::MediaConstraints const&, WebCore::FlattenedConstraint&, WTF::String&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#10 0x00007f8f767a465a in WebCore::RealtimeMediaSource::supportsConstraints(WebCore::MediaConstraints const&, WTF::String&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#11 0x00007f8f767a4ab7 in WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices(WebCore::MediaStreamRequest const&, WTF::Vector<WebCore::RealtimeMediaSourceCenter::DeviceInfo, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WTF::String&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#12 0x00007f8f767a6255 in WebCore::RealtimeMediaSourceCenter::validateRequestConstraints(WTF::Function<void (WTF::Vector<WebCore::CaptureDevice, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&, WTF::Vector<WebCore::CaptureDevice, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&, WTF::String&&)>&&, WTF::Function<void (WTF::String const&)>&&, WebCore::MediaStreamRequest const&, WTF::String&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#13 0x00007f8f75182e54 in WTF::Detail::CallableWrapper<WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest()::{lambda(WTF::String&&)#1}, void, WTF::String&&>::call(WTF::String&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#14 0x00007f8f7516b75f in WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall(WebCore::SecurityOriginData&&, WebCore::SecurityOriginData&&, WTF::CompletionHandler<void (WTF::String&&)>&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#15 0x00007f8f7516ba71 in WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin(WebCore::SecurityOrigin const&, WebCore::SecurityOrigin const&, WTF::CompletionHandler<void (WTF::String&&)>&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#16 0x00007f8f75184e6e in WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest() () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#17 0x00007f8f75186904 in WTF::Detail::CallableWrapper<WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest(WTF::Ref<WebKit::UserMediaPermissionRequestProxy, WTF::DumbPtrTraits<WebKit::UserMediaPermissionRequestProxy> >&&)::{lambda(auto:1)#1}, void, WebKit::UserMediaPermissionCheckProxy::PermissionInfo>::call(WebKit::UserMediaPermissionCheckProxy) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#18 0x00007f8f75185903 in WTF::Detail::CallableWrapper<WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::CompletionHandler<void (WebKit::UserMediaPermissionCheckProxy::PermissionInfo)>&&)::{lambda(auto:1)#1}, void, WebKit::UserMediaPermissionCheckProxy::PermissionInfo>::call(WebKit::UserMediaPermissionCheckProxy::PermissionInfo) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#19 0x00007f8f751816fb in WebKit::UserMediaPermissionCheckProxy::complete(WebKit::UserMediaPermissionCheckProxy::PermissionInfo) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#20 0x000055c820dffb01 in WTR::TestController::handleCheckOfUserMediaPermissionForOrigin(OpaqueWKFrame const*, OpaqueWKSecurityOrigin const*, OpaqueWKSecurityOrigin const*, OpaqueWKUserMediaPermissionCheck const* const&) ()
#21 0x000055c820dffbba in WTR::checkUserMediaPermissionForOrigin(OpaqueWKPage const*, OpaqueWKFrame const*, OpaqueWKSecurityOrigin const*, OpaqueWKSecurityOrigin const*, OpaqueWKUserMediaPermissionCheck const*, void const*) ()
#22 0x00007f8f75185e20 in WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::CompletionHandler<void (WebKit::UserMediaPermissionCheckProxy::PermissionInfo)>&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#23 0x00007f8f75185ed4 in WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest(WTF::Ref<WebKit::UserMediaPermissionRequestProxy, WTF::DumbPtrTraits<WebKit::UserMediaPermissionRequestProxy> >&&) () from /home/slave/webkitgtk/gtk-linux-64-release/build/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37


See: https://build.webkit.org/results/WPE%20Linux%2064-bit%20Release%20(Tests)/r260564%20(17842)/fast/mediastream/getDisplayMedia-max-constraints-crash-log.txt

STDERR: 1   0x7f7ae8f47dc9 WTFCrash
STDERR: 2   0x7f7ae5719c3f /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x21fdc3f) [0x7f7ae5719c3f]
STDERR: 3   0x7f7ae71cd7b2 /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x3cb17b2) [0x7f7ae71cd7b2]
STDERR: 4   0x7f7ae71bf937 WebCore::RealtimeVideoCaptureSource::presets()
STDERR: 5   0x7f7ae78b63d0 WebCore::MockGStreamerVideoCaptureSource::generatePresets()
STDERR: 6   0x7f7ae71bf937 WebCore::RealtimeVideoCaptureSource::presets()
STDERR: 7   0x7f7ae71c1af8 WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate(WTF::Optional<int>, WTF::Optional<int>, WTF::Optional<double>)
STDERR: 8   0x7f7ae71c25ea WebCore::RealtimeVideoCaptureSource::supportsSizeAndFrameRate(WTF::Optional<int>, WTF::Optional<int>, WTF::Optional<double>)
STDERR: 9   0x7f7ae71ac043 WebCore::RealtimeMediaSource::supportsSizeAndFrameRate(WTF::Optional<WebCore::IntConstraint>, WTF::Optional<WebCore::IntConstraint>, WTF::Optional<WebCore::DoubleConstraint>, WTF::String&, double&)
STDERR: 10  0x7f7ae71b1082 WebCore::RealtimeMediaSource::selectSettings(WebCore::MediaConstraints const&, WebCore::FlattenedConstraint&, WTF::String&)
STDERR: 11  0x7f7ae71b27ca WebCore::RealtimeMediaSource::supportsConstraints(WebCore::MediaConstraints const&, WTF::String&)
STDERR: 12  0x7f7ae71b2c1f WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices(WebCore::MediaStreamRequest const&, WTF::Vector<WebCore::RealtimeMediaSourceCenter::DeviceInfo, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WTF::String&)
STDERR: 13  0x7f7ae71b38e5 WebCore::RealtimeMediaSourceCenter::validateRequestConstraints(WTF::Function<void (WTF::Vector<WebCore::CaptureDevice, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&, WTF::Vector<WebCore::CaptureDevice, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&&, WTF::String&&)>&&, WTF::Function<void (WTF::String const&)>&&, WebCore::MediaStreamRequest const&, WTF::String&&)
STDERR: 14  0x7f7ae596c79e /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x245079e) [0x7f7ae596c79e]
STDERR: 15  0x7f7ae5955549 WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall(WebCore::SecurityOriginData&&, WebCore::SecurityOriginData&&, WTF::CompletionHandler<void (WTF::String&&)>&&)
STDERR: 16  0x7f7ae5955887 WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin(WebCore::SecurityOrigin const&, WebCore::SecurityOrigin const&, WTF::CompletionHandler<void (WTF::String&&)>&&)
STDERR: 17  0x7f7ae596f92c WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest()
STDERR: 18  0x7f7ae5971164 /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x2455164) [0x7f7ae5971164]
STDERR: 19  0x7f7ae596fffc /app/webkit/WebKitBuild/Release/lib/libWPEWebKit-1.0.so.3(+0x2453ffc) [0x7f7ae596fffc]
STDERR: 20  0x7f7ae596bddc WebKit::UserMediaPermissionCheckProxy::complete(WebKit::UserMediaPermissionCheckProxy::PermissionInfo)
STDERR: 21  0x559da575f0ed /app/webkit/WebKitBuild/Release/bin/WebKitTestRunner(+0x310ed) [0x559da575f0ed]
STDERR: 22  0x559da575f1aa /app/webkit/WebKitBuild/Release/bin/WebKitTestRunner(+0x311aa) [0x559da575f1aa]
STDERR: 23  0x7f7ae59705ea WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::CompletionHandler<void (WebKit::UserMediaPermissionCheckProxy::PermissionInfo)>&&)
STDERR: 24  0x7f7ae59706c2 WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest(WTF::Ref<WebKit::UserMediaPermissionRequestProxy, WTF::DumbPtrTraits<WebKit::UserMediaPermissionRequestProxy> >&&)
STDERR: 25  0x7f7ae5971848 WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame(unsigned long, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WebCore::MediaStreamRequest&&)
STDERR: 26  0x7f7ae59a11f1 WebKit::WebPageProxy::requestUserMediaPermissionForFrame(unsigned long, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData const&, WebCore::SecurityOriginData const&, WebCore::MediaStreamRequest&&)
STDERR: 27  0x7f7ae56ccc07 void IPC::handleMessage<Messages::WebPageProxy::RequestUserMediaPermissionForFrame, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData const&, WebCore::SecurityOriginData const&, WebCore::MediaStreamRequest&&)>(IPC::Decoder&, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(unsigned long, WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WebCore::SecurityOriginData const&, WebCore::SecurityOriginData const&, WebCore::MediaStreamRequest&&))
STDERR: 28  0x7f7ae569d25f WebKit::WebPageProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
STDERR: 29  0x7f7ae58cf66a IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&)
STDERR: 30  0x7f7ae599f98f non-virtual thunk to WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&)
STDERR: 31  0x7f7ae58c8280 IPC::Connection::dispatchMessage(IPC::Decoder&)
Comment 1 Philippe Normand 2020-04-29 07:19:50 PDT
This crash currently happens because the mock realtime media source center creates a video mock source instead of a display capture mock source.

I'm working on a patch touching mock sources and now those tests timeout.
Comment 2 Philippe Normand 2020-04-29 07:22:01 PDT
I will skip them, we know getDisplayMedia doesn't work yet and adding 3 or 4 timeouts to the already very slow bots isn't helping.
Comment 3 Zan Dobersek 2020-05-19 00:31:31 PDT
FYI, no longer crashing but only timing out.
Comment 4 Diego Pino 2020-06-15 20:45:11 PDT
fast/mediastream/getDisplayMedia-max-constraints1.html is a flaky Crash:

https://results.webkit.org/?platform=WPE&platform=GTK&suite=layout-tests&test=fast%2Fmediastream%2FgetDisplayMedia-max-constraints1.html

fast/mediastream/getDisplayMedia-max-constraints3.html had only one Crash since r261853.

Latest crash log for getDisplayMedia-max-constraints1.html:

Crash-log: https://build.webkit.org/results/WPE%20Linux%2064-bit%20Release%20(Tests)/r263069%20(18619)/fast/mediastream/getDisplayMedia-max-constraints1-crash-log.txt

STDERR:
STDERR: (WPEWebProcess:13235): GLib-GObject-CRITICAL **: 18:15:49.770: g_object_ref: assertion 'old_val > 0' failed

Thread 1 (Thread 0x7fb084cfe700 (LWP 14447)):
#0  0x00007fb16b67eee5 in _g_log_abort (breakpoint=1) at ../glib/gmessages.c:554
#1  0x00007fb16b6801c9 in g_logv (log_domain=0x7fb16be6b2f7 "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fb084cfa470) at ../glib/gmessages.c:1373
#2  0x00007fb16b680393 in g_log (log_domain=log_domain@entry=0x7fb16be6b2f7 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fb16b6d177f "%s: assertion '%s' failed") at ../glib/gmessages.c:1415
#3  0x00007fb16b680b8d in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fb16be6b2f7 "GLib-GObject", pretty_function=pretty_function@entry=0x7fb16be6e978 <__func__.15604> "g_object_ref", expression=expression@entry=0x7fb16be6d715 "old_val > 0") at ../glib/gmessages.c:2771
#4  0x00007fb16be3e9fa in g_object_ref (_object=0x7fb098057310) at ../gobject/gobject.c:3368
#5  0x00007fb16be3e9fa in g_object_ref (_object=0x7fb098057310) at ../gobject/gobject.c:3360
#6  0x00007fb16be3eb08 in g_value_object_collect_value (value=0x7fb084cfa588, n_collect_values=<optimized out>, collect_values=<optimized out>, collect_flags=<optimized out>) at ../gobject/gobject.c:4007
#7  0x00007fb16b585a46 in gst_structure_set_valist_internal (structure=0x7fb06c045a60, fieldname=<optimized out>, varargs=varargs@entry=0x7fb084cfa630) at ../gst/gststructure.c:631
#8  0x00007fb16b586dc6 in gst_structure_set (structure=structure@entry=0x7fb06c045a60, field=field@entry=0x7fb16c2f1a19 "context") at ../gst/gststructure.c:663
#9  0x00007fb16c2dc8e5 in gst_gl_handle_context_query (element=element@entry=0x55a06c4547c0 [GstGLUploadElement], query=query@entry=0x55a06c265590 [GstQuery], display=<optimized out>, gl_context=0x7fb098057310 [GstGLContextEGL], other_context=<optimized out>) at ../gst-libs/gst/gl/gstglutils.c:550
#10 0x00007fb16c2b9b1b in gst_gl_base_filter_query (trans=0x55a06c4547c0 [GstGLUploadElement], direction=GST_PAD_SRC, query=0x55a06c265590 [GstQuery]) at ../gst-libs/gst/gl/gstglbasefilter.c:224
#11 0x00007fb16b563238 in gst_pad_query (pad=pad@entry=0x7fb098047b20 [GstPad], query=query@entry=0x55a06c265590 [GstQuery]) at ../gst/gstpad.c:4072
#12 0x00007fb16b56399b in gst_pad_peer_query (pad=pad@entry=0x7fb0980478d0 [GstPad], query=query@entry=0x55a06c265590 [GstQuery]) at ../gst/gstpad.c:4204
#13 0x00007fb16c2db9b6 in pad_query (item=<optimized out>, value=0x7fb084cfa970, user_data=0x55a06c265590) at ../gst-libs/gst/gl/gstglutils.c:108
#14 0x00007fb16b55113c in gst_iterator_fold (it=it@entry=0x7fb0980048a0, func=func@entry=0x7fb16c2db990 <pad_query>, ret=ret@entry=0x7fb084cfa970, user_data=user_data@entry=0x55a06c265590) at ../gst/gstiterator.c:617
#15 0x00007fb16c2dbb26 in gst_gl_run_query (element=<optimized out>, query=query@entry=0x55a06c265590 [GstQuery], direction=direction@entry=GST_PAD_SINK) at ../gst-libs/gst/gl/gstglutils.c:136
#16 0x00007fb16c2dcabd in gst_gl_query_local_gl_context (element=0x55a06c454b30 [GstGLColorConvertElement], direction=direction@entry=GST_PAD_SINK, context_ptr=context_ptr@entry=0x55a06c454d78) at ../gst-libs/gst/gl/gstglutils.c:591
#17 0x00007fb16c2b964e in _find_local_gl_context (filter=0x55a06c454b30 [GstGLColorConvertElement]) at ../gst-libs/gst/gl/gstglbasefilter.c:197
#18 0x00007fb16c2b9df5 in gst_gl_base_filter_find_gl_context (filter=0x55a06c454b30 [GstGLColorConvertElement]) at ../gst-libs/gst/gl/gstglbasefilter.c:432
#19 0x00007fb109f434b1 in gst_gl_color_convert_element_transform_caps (bt=0x55a06c454b30 [GstGLColorConvertElement], direction=GST_PAD_SRC, caps=0x55a06c498f70 [GstCaps], filter=0x0) at ../ext/gl/gstglcolorconvertelement.c:145
#20 0x00007fb16c50ce71 in gst_base_transform_transform_caps (trans=trans@entry=0x55a06c454b30 [GstGLColorConvertElement], direction=GST_PAD_SRC, caps=caps@entry=0x55a06c498f70 [GstCaps], filter=filter@entry=0x0) at ../libs/gst/base/gstbasetransform.c:474
Comment 5 Lauro Moura 2021-02-16 09:46:57 PST
Update on these tests

fast/mediastream/getDisplayMedia-max-constraints.html was removed in r260638.

r272778 "Make RemoteRealtimeVideoSource a RealtimeVideoCaptureSource" made the timeouts vanish for constraints1 and constraints2, but still flaky timeout in constraints3.

Will update the expectations with Failures for 1&2 and skip 3.

Failures still present:

--- /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints1-expected.txt
+++ /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints1-actual.txt
@@ -1,4 +1,4 @@
 
 PASS setup
-PASS Maximize the width if max height is too big
+FAIL Maximize the width if max height is too big assert_greater_than: waitForHeight expected a number greater than 0 but got 0

--- /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints2-expected.txt
+++ /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints2-actual.txt
@@ -1,4 +1,4 @@
 
 PASS setup
-PASS Maximize the height if max width is too big
+FAIL Maximize the height if max width is too big assert_greater_than: waitForWidth expected a number greater than 0 but got 0


--- /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints3-expected.txt
+++ /home/buildbot/worker/wpe-linux-64-release-tests/build/layout-test-results/fast/mediastream/getDisplayMedia-max-constraints3-actual.txt
@@ -1,4 +1,4 @@
 
 PASS setup
-PASS No effect of the max values if they are too big
+FAIL No effect of the max values if they are too big assert_greater_than: waitForHeight expected a number greater than 0 but got 0
Comment 6 Philippe Normand 2021-07-11 08:45:51 PDT
*** Bug 191007 has been marked as a duplicate of this bug. ***
Comment 7 Philippe Normand 2021-07-11 10:08:52 PDT
Created attachment 433289 [details]
Patch
Comment 8 EWS Watchlist 2021-07-11 10:09:56 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 9 Víctor M. Jáquez L. 2021-07-12 07:30:58 PDT
Comment on attachment 433289 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=433289&action=review

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:275
> +    CaptureDevice captureDevice(WTF::numberToStringUnsigned<String>(fd), CaptureDevice::DeviceType::Screen, makeString("Capture Display"));

I see there's a 

XdpSessionType xdp_session_get_session_type (XdpSession *session);

I don't know if that's what you need.
Comment 10 Philippe Normand 2021-07-12 07:43:15 PDT
Comment on attachment 433289 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=433289&action=review

>> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:275
>> +    CaptureDevice captureDevice(WTF::numberToStringUnsigned<String>(fd), CaptureDevice::DeviceType::Screen, makeString("Capture Display"));
> 
> I see there's a 
> 
> XdpSessionType xdp_session_get_session_type (XdpSession *session);
> 
> I don't know if that's what you need.

Sadly, unrelated. I went this path already and found:

/**
 * XdpSessionType:
 * @XDP_SESSION_SCREENCAST: a screencast session.
 * @XDP_SESSION_REMOTE_DESKTOP: a remote desktop session.
 *
 * The type of a session.
 */
typedef enum {
  XDP_SESSION_SCREENCAST,
  XDP_SESSION_REMOTE_DESKTOP
} XdpSessionType;
Comment 11 Philippe Normand 2021-07-13 00:33:15 PDT
I'll move the API in a separate patch...
Comment 12 Philippe Normand 2021-07-13 05:02:51 PDT
Created attachment 433400 [details]
Patch
Comment 13 Xabier Rodríguez Calvar 2021-07-13 08:31:19 PDT
Comment on attachment 433400 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=433400&action=review

> Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:1104
> +    auto deviceType = this->deviceType();
> +    if (deviceType != CaptureDevice::DeviceType::Screen && deviceType != CaptureDevice::DeviceType::Window)
> +        ASSERT(!m_hashedID.isEmpty());

I think we should flag all this if #ifndef NDEBUG .

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:234
> +    xdp_portal_create_screencast_session(m_portal.get(), static_cast<XdpOutputType>(XDP_OUTPUT_MONITOR | XDP_OUTPUT_WINDOW), XDP_SCREENCAST_FLAG_NONE, nullptr, [](GObject* source, GAsyncResult* result, gpointer userData) {
> +        GUniqueOutPtr<GError> error;
> +        auto* session = xdp_portal_create_screencast_session_finish(XDP_PORTAL(source), result, &error.outPtr());
> +        if (!session) {
> +            WTFLogAlways("Failed to create screencast session: %s", error->message);
> +            return;
> +        }
> +        auto& manager = *reinterpret_cast<GStreamerDisplayCaptureDeviceManager*>(userData);

Are we sure this is going to outlive this callback? Otherwise we might even want to turn GStreamerDisplayCaptureDeviceManager into RefCounted or WeakPtr and use it here.

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:251
> +    g_signal_connect_swapped(m_session.get(), "closed", G_CALLBACK(+[](GStreamerDisplayCaptureDeviceManager* manager, XdpSession*) {
> +        manager->sessionWasClosed();
> +    }), this);

Ditto.

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:255
> +    xdp_session_start(m_session.get(), nullptr, nullptr, [](GObject* source, GAsyncResult* result, gpointer userData) {
> +        auto* session = XDP_SESSION(source);
> +        GUniqueOutPtr<GError> error;
> +        auto& manager = *reinterpret_cast<GStreamerDisplayCaptureDeviceManager*>(userData);

Ditto

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:274
> +    // user, so hardcode Screen here. ð¤·

Weird characters at the end?

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:96
> +    GRefPtr<XdpPortal> m_portal;
> +    GRefPtr<XdpSession> m_session;

I guess these are GObjects and we don't need to specify refGPtr and derefGPtr, right?

> Source/WebCore/platform/mediastream/gstreamer/GStreamerCapturer.cpp:109
> +            gst_pad_add_probe(pad.get(), GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, [](GstPad*, GstPadProbeInfo* info, void* userData) -> GstPadProbeReturn {
> +                auto* event = gst_pad_probe_info_get_event(info);
> +                if (GST_EVENT_TYPE(event) != GST_EVENT_CAPS)
> +                    return GST_PAD_PROBE_OK;
> +
> +                callOnMainThread([event, capturer = reinterpret_cast<GStreamerCapturer*>(userData)] {

Ditto.
Comment 14 Philippe Normand 2021-07-15 04:18:50 PDT
Comment on attachment 433400 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=433400&action=review

>> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:234
>> +        auto& manager = *reinterpret_cast<GStreamerDisplayCaptureDeviceManager*>(userData);
> 
> Are we sure this is going to outlive this callback? Otherwise we might even want to turn GStreamerDisplayCaptureDeviceManager into RefCounted or WeakPtr and use it here.

AFAICS it's a singleton, NeverDestroyed<GStreamerDisplayCaptureDeviceManager>.

>> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:274
>> +    // user, so hardcode Screen here. ð¤·
> 
> Weird characters at the end?

Shrug emoji.

>> Source/WebCore/platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h:96
>> +    GRefPtr<XdpSession> m_session;
> 
> I guess these are GObjects and we don't need to specify refGPtr and derefGPtr, right?

Right!
Comment 15 Philippe Normand 2021-07-15 04:49:24 PDT
Committed r279940 (239684@main): <https://commits.webkit.org/239684@main>
Comment 16 Radar WebKit Bug Importer 2021-07-15 04:50:18 PDT
<rdar://problem/80625215>
Comment 17 youenn fablet 2021-08-06 02:51:29 PDT
Comment on attachment 433400 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=433400&action=review

> Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp:115
> +    auto size = m_source->size();

This broke an API test, see https://bugs.webkit.org/show_bug.cgi?id=228759.

> Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:114
> +    return CaptureSourceOrError(WTFMove(source));

To enable resizing and so on, we usually wrap the realtime video capture source with a realtime video source.
Something like: "return CaptureSourceOrError(RealtimeVideoSource::create(WTFMove(source)));"

I wonder whether doing so would allow removing some of the changes to the RealtimeXXSource classes.
Comment 18 Philippe Normand 2021-08-16 04:17:07 PDT
(In reply to youenn fablet from comment #17)
> Comment on attachment 433400 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=433400&action=review
> 
> > Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp:115
> > +    auto size = m_source->size();
> 
> This broke an API test, see https://bugs.webkit.org/show_bug.cgi?id=228759.
> 
> > Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:114
> > +    return CaptureSourceOrError(WTFMove(source));
> 
> To enable resizing and so on, we usually wrap the realtime video capture
> source with a realtime video source.
> Something like: "return
> CaptureSourceOrError(RealtimeVideoSource::create(WTFMove(source)));"
> 
> I wonder whether doing so would allow removing some of the changes to the
> RealtimeXXSource classes.

Does not help.