Title: [281305] trunk
Revision
281305
Author
[email protected]
Date
2021-08-20 03:16:50 -0700 (Fri, 20 Aug 2021)

Log Message

REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
https://bugs.webkit.org/show_bug.cgi?id=228941

Reviewed by Youenn Fablet.

Source/WebCore:

The GStreamer mock display capture source is now wrapped in another RealtimeMediaSource in
order to avoid a spurious setSize() call from the RealtimeVideoSource constructor that would
then prevent the mock source to ensure its size matches the intrinsic size.

For the non-mock display capture source, we now ensure the size matches the intrinsic size
whenever the capture settings have changed.

* platform/mediastream/RealtimeVideoCaptureSource.h:
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::settingsDidChange):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
(WebCore::MockDisplayCaptureSourceGStreamer::create):
(WebCore::MockDisplayCaptureSourceGStreamer::capabilities):
(WebCore::MockDisplayCaptureSourceGStreamer::settings):
* platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::generateFrame):

LayoutTests:

* platform/glib/TestExpectations: Unflag tests now passing.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281304 => 281305)


--- trunk/LayoutTests/ChangeLog	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/LayoutTests/ChangeLog	2021-08-20 10:16:50 UTC (rev 281305)
@@ -1,3 +1,12 @@
+2021-08-20  Philippe Normand  <[email protected]>
+
+        REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
+        https://bugs.webkit.org/show_bug.cgi?id=228941
+
+        Reviewed by Youenn Fablet.
+
+        * platform/glib/TestExpectations: Unflag tests now passing.
+
 2021-08-20  Youenn Fablet  <[email protected]>
 
         Add support for RTCPeerConnection.canTrickleIceCandidates

Modified: trunk/LayoutTests/platform/glib/TestExpectations (281304 => 281305)


--- trunk/LayoutTests/platform/glib/TestExpectations	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2021-08-20 10:16:50 UTC (rev 281305)
@@ -626,9 +626,6 @@
 webkit.org/b/227934 media/media-source/media-webm-vorbis-partial.html [ Failure ]
 webkit.org/b/227934 media/media-source/media-webm-opus-partial.html [ Failure ]
 
-webkit.org/b/228941 fast/mediastream/getDisplayMedia-max-constraints1.html [ Timeout Failure ]
-webkit.org/b/228941 fast/mediastream/getDisplayMedia-max-constraints2.html [ Timeout Failure ]
-
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of GStreamer-related bugs
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/Source/WebCore/ChangeLog (281304 => 281305)


--- trunk/Source/WebCore/ChangeLog	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/ChangeLog	2021-08-20 10:16:50 UTC (rev 281305)
@@ -1,3 +1,29 @@
+2021-08-20  Philippe Normand  <[email protected]>
+
+        REGRESSION(r280732) [GStreamer] fast/mediastream/getDisplayMedia-max-constraints1.html and other are failing
+        https://bugs.webkit.org/show_bug.cgi?id=228941
+
+        Reviewed by Youenn Fablet.
+
+        The GStreamer mock display capture source is now wrapped in another RealtimeMediaSource in
+        order to avoid a spurious setSize() call from the RealtimeVideoSource constructor that would
+        then prevent the mock source to ensure its size matches the intrinsic size.
+
+        For the non-mock display capture source, we now ensure the size matches the intrinsic size
+        whenever the capture settings have changed.
+
+        * platform/mediastream/RealtimeVideoCaptureSource.h:
+        * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
+        (WebCore::GStreamerVideoCaptureSource::settingsDidChange):
+        * platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp:
+        (WebCore::MockDisplayCaptureSourceGStreamer::create):
+        (WebCore::MockDisplayCaptureSourceGStreamer::capabilities):
+        (WebCore::MockDisplayCaptureSourceGStreamer::settings):
+        * platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h:
+        * platform/mock/MockRealtimeMediaSourceCenter.cpp:
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::generateFrame):
+
 2021-08-20  Myles C. Maxfield  <[email protected]>
 
         GlyphBuffer can become inconsistent with its backing string

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h (281304 => 281305)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h	2021-08-20 10:16:50 UTC (rev 281305)
@@ -51,6 +51,8 @@
     double observedFrameRate() const { return m_observedFrameRate; }
     Vector<VideoPresetData> presetsData();
 
+    void ensureIntrinsicSizeMaintainsAspectRatio();
+
 protected:
     RealtimeVideoCaptureSource(String&& name, String&& id, String&& hashSalt);
 
@@ -73,8 +75,6 @@
     void dispatchMediaSampleToObservers(MediaSample&);
     const Vector<IntSize>& standardVideoSizes();
 
-    void ensureIntrinsicSizeMaintainsAspectRatio();
-
 private:
     struct CaptureSizeAndFrameRate {
         RefPtr<VideoPreset> encodingPreset;

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp (281304 => 281305)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2021-08-20 10:16:50 UTC (rev 281305)
@@ -153,8 +153,13 @@
 
 void GStreamerVideoCaptureSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings)
 {
-    if (settings.containsAny({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height }))
+    if (settings.containsAny({ RealtimeMediaSourceSettings::Flag::Width, RealtimeMediaSourceSettings::Flag::Height })) {
+        if (m_deviceType == CaptureDevice::DeviceType::Window || m_deviceType == CaptureDevice::DeviceType::Screen)
+            ensureIntrinsicSizeMaintainsAspectRatio();
+
         m_capturer->setSize(size().width(), size().height());
+    }
+
     if (settings.contains(RealtimeMediaSourceSettings::Flag::FrameRate))
         m_capturer->setFrameRate(frameRate());
 }

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp (281304 => 281305)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.cpp	2021-08-20 10:16:50 UTC (rev 281305)
@@ -50,22 +50,61 @@
     return CaptureSourceOrError(RealtimeVideoSource::create(WTFMove(source)));
 }
 
-CaptureSourceOrError MockRealtimeVideoSourceGStreamer::createMockDisplayCaptureSource(String&& deviceID, String&& name, String&& hashSalt, const MediaConstraints* constraints)
+CaptureSourceOrError MockDisplayCaptureSourceGStreamer::create(const CaptureDevice& device, const MediaConstraints* constraints)
 {
-    auto source = MockRealtimeVideoSourceGStreamer::createForMockDisplayCapturer(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt));
+    auto mockSource = adoptRef(*new MockRealtimeVideoSourceGStreamer(String { device.persistentId() }, String { device.label() }, { }));
+
     if (constraints) {
-        if (auto error = source->applyConstraints(*constraints))
+        if (auto error = mockSource->applyConstraints(*constraints))
             return WTFMove(error.value().badConstraint);
     }
 
-    return CaptureSourceOrError(RealtimeVideoSource::create(WTFMove(source)));
+    auto source = adoptRef(*new MockDisplayCaptureSourceGStreamer(WTFMove(mockSource), device.type()));
+    return CaptureSourceOrError(WTFMove(source));
 }
 
-Ref<MockRealtimeVideoSource> MockRealtimeVideoSourceGStreamer::createForMockDisplayCapturer(String&& deviceID, String&& name, String&& hashSalt)
+const RealtimeMediaSourceCapabilities& MockDisplayCaptureSourceGStreamer::capabilities()
 {
-    return adoptRef(*new MockRealtimeVideoSourceGStreamer(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)));
+    if (!m_capabilities) {
+        RealtimeMediaSourceCapabilities capabilities(settings().supportedConstraints());
+
+        // FIXME: what should these be?
+        capabilities.setWidth(CapabilityValueOrRange(1, 3840));
+        capabilities.setHeight(CapabilityValueOrRange(1, 2160));
+        capabilities.setFrameRate(CapabilityValueOrRange(.01, 30.0));
+
+        m_capabilities = WTFMove(capabilities);
+    }
+    return m_capabilities.value();
 }
 
+const RealtimeMediaSourceSettings& MockDisplayCaptureSourceGStreamer::settings()
+{
+    if (!m_currentSettings) {
+        RealtimeMediaSourceSettings settings;
+        settings.setFrameRate(frameRate());
+
+        m_source->ensureIntrinsicSizeMaintainsAspectRatio();
+        auto size = m_source->size();
+        settings.setWidth(size.width());
+        settings.setHeight(size.height());
+
+        settings.setLogicalSurface(false);
+
+        RealtimeMediaSourceSupportedConstraints supportedConstraints;
+        supportedConstraints.setSupportsFrameRate(true);
+        supportedConstraints.setSupportsWidth(true);
+        supportedConstraints.setSupportsHeight(true);
+        supportedConstraints.setSupportsDisplaySurface(true);
+        supportedConstraints.setSupportsLogicalSurface(true);
+
+        settings.setSupportedConstraints(supportedConstraints);
+
+        m_currentSettings = WTFMove(settings);
+    }
+    return m_currentSettings.value();
+}
+
 MockRealtimeVideoSourceGStreamer::MockRealtimeVideoSourceGStreamer(String&& deviceID, String&& name, String&& hashSalt)
     : MockRealtimeVideoSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt))
 {

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h (281304 => 281305)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockRealtimeVideoSourceGStreamer.h	2021-08-20 10:16:50 UTC (rev 281305)
@@ -30,20 +30,46 @@
 
 class MockRealtimeVideoSourceGStreamer final : public MockRealtimeVideoSource {
 public:
-    static Ref<MockRealtimeVideoSource> createForMockDisplayCapturer(String&& deviceID, String&& name, String&& hashSalt);
-
-    static CaptureSourceOrError createMockDisplayCaptureSource(String&& deviceID, String&& name, String&& hashSalt, const MediaConstraints*);
-
+    MockRealtimeVideoSourceGStreamer(String&& deviceID, String&& name, String&& hashSalt);
     ~MockRealtimeVideoSourceGStreamer() = default;
 
 private:
     friend class MockRealtimeVideoSource;
-    MockRealtimeVideoSourceGStreamer(String&& deviceID, String&& name, String&& hashSalt);
 
     void updateSampleBuffer() final;
     bool canResizeVideoFrames() const final { return true; }
 };
 
+class MockDisplayCaptureSourceGStreamer final : public RealtimeMediaSource {
+public:
+    static CaptureSourceOrError create(const CaptureDevice&, const MediaConstraints*);
+
+private:
+    MockDisplayCaptureSourceGStreamer(Ref<MockRealtimeVideoSourceGStreamer>&& source, CaptureDevice::DeviceType type)
+        : RealtimeMediaSource(Type::Video, source->name().isolatedCopy())
+        , m_source(WTFMove(source))
+        , m_type(type) { }
+
+    friend class MockRealtimeVideoSourceGStreamer;
+
+    void startProducingData() final { m_source->start(); }
+    void stopProducingData() final { m_source->stop(); }
+    void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) final { m_currentSettings = { }; }
+    bool isCaptureSource() const final { return true; }
+    const RealtimeMediaSourceCapabilities& capabilities() final;
+    const RealtimeMediaSourceSettings& settings() final;
+    CaptureDevice::DeviceType deviceType() const { return m_type; }
+
+#if !RELEASE_LOG_DISABLED
+    const char* logClassName() const final { return "MockDisplayCaptureSourceGStreamer"; }
+#endif
+
+    Ref<MockRealtimeVideoSourceGStreamer> m_source;
+    CaptureDevice::DeviceType m_type;
+    std::optional<RealtimeMediaSourceCapabilities> m_capabilities;
+    std::optional<RealtimeMediaSourceSettings> m_currentSettings;
+};
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp (281304 => 281305)


--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp	2021-08-20 10:16:50 UTC (rev 281305)
@@ -165,7 +165,7 @@
 #if PLATFORM(MAC)
             return DisplayCaptureSourceCocoa::create(UniqueRef<DisplayCaptureSourceCocoa::Capturer>(makeUniqueRef<MockDisplayCapturer>(device)), device, constraints);
 #elif USE(GSTREAMER)
-            return MockRealtimeVideoSourceGStreamer::createMockDisplayCaptureSource(String { device.persistentId() }, String { device.label() }, String { }, constraints);
+            return MockDisplayCaptureSourceGStreamer::create(device, constraints);
 #else
             return MockRealtimeVideoSource::create(String { device.persistentId() }, String { device.label() }, String { }, constraints);
 #endif

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (281304 => 281305)


--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2021-08-20 09:22:42 UTC (rev 281304)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp	2021-08-20 10:16:50 UTC (rev 281305)
@@ -432,9 +432,6 @@
         m_delayUntil = MonotonicTime();
     }
 
-    if (mockDisplay() && !m_frameNumber)
-        ensureIntrinsicSizeMaintainsAspectRatio();
-
     ImageBuffer* buffer = imageBuffer();
     if (!buffer)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to