Bug 228941 - REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
Summary: REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constrai...
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
Depends on:
Blocks:
 
Reported: 2021-08-09 19:46 PDT by Lauro Moura
Modified: 2021-09-03 07:42 PDT (History)
12 users (show)

See Also:


Attachments
Patch (3.44 KB, patch)
2021-08-16 04:22 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (13.28 KB, patch)
2021-08-19 05:00 PDT, Philippe Normand
youennf: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2021-08-09 19:46:21 PDT
fast/mediastream/getDisplayMedia-max-constraints1.html
fast/mediastream/getDisplayMedia-max-constraints2.html

After r280732 (240319@main) (partial revert from r279940)

Both tests fail/time out while waiting for the expectedWidth, which always comes unadjusted for the aspect ratio. e.g. the first test expects 281 for height but only 500 is arriving.

While inspecting the mockvideosource code, indeed the source has its size changed to the expected value, but this doesn't seems to be reflected in the track settings attribute.
Comment 1 Philippe Normand 2021-08-16 04:22:58 PDT
Created attachment 435586 [details]
Patch
Comment 2 youenn fablet 2021-08-16 05:49:46 PDT
Comment on attachment 435586 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        GStreamer ports differ in that regard, in their mock source implementations.

Diverting here is probably not very healthy, though it is true that cocoa port is doing capture out of process and GStreamer is probably not.
Is it only the mock sources that differ or is it also the case for actual sources?
If the issue is with mock, can we realign mocks?

> Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp:119
>      if (size.isEmpty())

Do you know why size is not empty here for those tests in GStreamer but is empty for Cocoa port?
Comment 3 Philippe Normand 2021-08-16 06:29:03 PDT
In GStreamer ports we use our mock video source for mock'ing display capture, while the mac ports use a custom mock display capture source, MockDisplayCapturer (inherits from DisplayCaptureSourceCocoa::Capturer.

For us the size is not empty because it's set from the settings, whereas your Capturer seems to delay that to until the first frame has been generated. I haven't verified this though.
Comment 4 youenn fablet 2021-08-16 06:40:15 PDT
> For us the size is not empty because it's set from the settings

Where is it set in the source code? Does it mirror what the GStreamer capture source is doing?
Comment 5 Philippe Normand 2021-08-17 07:17:30 PDT
This code in the MockRealtimeVideoSource ctor:

    if (mockDisplay()) {
        auto& properties = WTF::get<MockDisplayProperties>(m_device.properties);
        setIntrinsicSize(properties.defaultSize);
        setSize(properties.defaultSize);
        m_fillColor = properties.fillColor;
        return;
    }
Comment 6 Philippe Normand 2021-08-17 07:35:17 PDT
Disabling that setSize call gets me passing tests :P
Comment 7 Philippe Normand 2021-08-17 07:51:03 PDT
(In reply to Philippe Normand from comment #6)
> Disabling that setSize call gets me passing tests :P

Hum no, this needs more debugging...
Comment 8 Philippe Normand 2021-08-19 05:00:59 PDT
Created attachment 435857 [details]
Patch
Comment 9 youenn fablet 2021-08-19 06:31:56 PDT
Comment on attachment 435857 [details]
Patch

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

> Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:31
>  class MockRealtimeVideoSourceGStreamer final : public MockRealtimeVideoSource {

It seems MockRealtimeVideoSourceGStreamer is only used for display. Should its name be updated? Should it be merged with MockDisplayCaptureSourceGStreamer at some point?

> Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:47
> +    MockDisplayCaptureSourceGStreamer(RefPtr<MockRealtimeVideoSourceGStreamer>&& source, CaptureDevice::DeviceType type)

Can it be made private? Can we pass a Ref<>&& source.

> Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:67
> +    RefPtr<MockRealtimeVideoSourceGStreamer> m_source;

Can we make it a Ref<>
Comment 10 Philippe Normand 2021-08-19 07:07:05 PDT
Comment on attachment 435857 [details]
Patch

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

>> Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:31
>>  class MockRealtimeVideoSourceGStreamer final : public MockRealtimeVideoSource {
> 
> It seems MockRealtimeVideoSourceGStreamer is only used for display. Should its name be updated? Should it be merged with MockDisplayCaptureSourceGStreamer at some point?

It's used for mocking cameras gUM as well.
Comment 11 Philippe Normand 2021-08-20 03:17:12 PDT
Committed r281305 (240725@main): <https://commits.webkit.org/240725@main>
Comment 12 Radar WebKit Bug Importer 2021-08-20 03:18:20 PDT
<rdar://problem/82163904>