Title: [264901] trunk
Revision
264901
Author
[email protected]
Date
2020-07-26 10:38:06 -0700 (Sun, 26 Jul 2020)

Log Message

Update capture MediaStreamTrack frameRate and aspectRatio capabilities
https://bugs.webkit.org/show_bug.cgi?id=214741

Reviewed by Eric Carlson.

Source/WebCore:

We support frame decimation to decrease the frame rate.
This allows to get a frame rate down to 1.
We support resizing up to max width/height resolution.
This allows very wide aspect ratios.
Covered by updated tests.

* platform/mediastream/RealtimeVideoCaptureSource.cpp:
(WebCore::RealtimeVideoCaptureSource::updateCapabilities):

LayoutTests:

* fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:
* fast/mediastream/apply-constraints-video-expected.txt:
* fast/mediastream/apply-constraints-video.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264900 => 264901)


--- trunk/LayoutTests/ChangeLog	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/LayoutTests/ChangeLog	2020-07-26 17:38:06 UTC (rev 264901)
@@ -1,3 +1,14 @@
+2020-07-26  Youenn Fablet  <[email protected]>
+
+        Update capture MediaStreamTrack frameRate and aspectRatio capabilities
+        https://bugs.webkit.org/show_bug.cgi?id=214741
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:
+        * fast/mediastream/apply-constraints-video-expected.txt:
+        * fast/mediastream/apply-constraints-video.html:
+
 2020-07-26  Diego Pino Garcia  <[email protected]>
 
         [GTK] Unreviewed test gardening. Garden flaky failures after r264897.

Modified: trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt (264900 => 264901)


--- trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt	2020-07-26 17:38:06 UTC (rev 264901)
@@ -4,10 +4,10 @@
 
 
 video track capabilities:
-  capabilities.aspectRatio = { max: 1.778, min: 1 }
+  capabilities.aspectRatio = { max: 2560, min: 0.001 }
   capabilities.deviceId = <UUID>
   capabilities.facingMode = [ user ]
-  capabilities.frameRate = { max: 30, min: 5 }
+  capabilities.frameRate = { max: 30, min: 1 }
   capabilities.height = { max: 1440, min: 1 }
   capabilities.width = { max: 2560, min: 1 }
 

Modified: trunk/LayoutTests/fast/mediastream/apply-constraints-video-expected.txt (264900 => 264901)


--- trunk/LayoutTests/fast/mediastream/apply-constraints-video-expected.txt	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/LayoutTests/fast/mediastream/apply-constraints-video-expected.txt	2020-07-26 17:38:06 UTC (rev 264901)
@@ -52,10 +52,10 @@
 ** Constraint: {"width":5000} - ideal width is greater than track capability, should be clamped to the maximum value.
 PASS settings['width'] is 2560
 
-** Constraint: {"width":100,"height":100,"frameRate":4} - frameRate value is less than track capabilities, should be clamped to the minimum values.
+** Constraint: {"width":100,"height":100,"frameRate":0.5} - frameRate value is less than track capabilities, should be clamped to the minimum values.
 PASS settings['width'] is 100
 PASS settings['height'] is 100
-PASS settings['frameRate'] is 5
+PASS settings['frameRate'] is 1
 
 ** Constraint: {"frameRate":20} - set frame rate, width and height should remain unchanged
 PASS settings['width'] is 100

Modified: trunk/LayoutTests/fast/mediastream/apply-constraints-video.html (264900 => 264901)


--- trunk/LayoutTests/fast/mediastream/apply-constraints-video.html	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/LayoutTests/fast/mediastream/apply-constraints-video.html	2020-07-26 17:38:06 UTC (rev 264901)
@@ -56,8 +56,8 @@
                 },
                 {
                     message: "frameRate value is less than track capabilities, should be clamped to the minimum values.",
-                    constraint: { width: 100, height: 100, frameRate: 4 },
-                    expected: { width: 100, height: 100, frameRate: 5 },
+                    constraint: { width: 100, height: 100, frameRate: 0.5 },
+                    expected: { width: 100, height: 100, frameRate: 1 },
                 },
                 {
                     message: "set frame rate, width and height should remain unchanged",

Modified: trunk/Source/WebCore/ChangeLog (264900 => 264901)


--- trunk/Source/WebCore/ChangeLog	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/Source/WebCore/ChangeLog	2020-07-26 17:38:06 UTC (rev 264901)
@@ -1,3 +1,19 @@
+2020-07-26  Youenn Fablet  <[email protected]>
+
+        Update capture MediaStreamTrack frameRate and aspectRatio capabilities
+        https://bugs.webkit.org/show_bug.cgi?id=214741
+
+        Reviewed by Eric Carlson.
+
+        We support frame decimation to decrease the frame rate.
+        This allows to get a frame rate down to 1.
+        We support resizing up to max width/height resolution.
+        This allows very wide aspect ratios.
+        Covered by updated tests.
+
+        * platform/mediastream/RealtimeVideoCaptureSource.cpp:
+        (WebCore::RealtimeVideoCaptureSource::updateCapabilities):
+
 2020-07-24  Mark Lam  <[email protected]>
 
         pluginElementCustomGetOwnPropertySlot() should support VMInquiry requests.

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp (264900 => 264901)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp	2020-07-26 17:20:53 UTC (rev 264900)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp	2020-07-26 17:38:06 UTC (rev 264901)
@@ -158,7 +158,8 @@
     int maximumHeight = 0;
     double minimumAspectRatio = std::numeric_limits<double>::max();
     double maximumAspectRatio = 0;
-    double minimumFrameRate = std::numeric_limits<double>::max();
+    // RealtimeVideoSource will decimate frame rate if the source cannot go below a given value.
+    double minimumFrameRate = 1;
     double maximumFrameRate = 0;
     for (const auto& preset : presets()) {
         const auto& size = preset->size;
@@ -166,15 +167,15 @@
         updateMinMax(minimumHeight, maximumHeight, size.height());
         updateMinMax(minimumAspectRatio, maximumAspectRatio, static_cast<double>(size.width()) / size.height());
 
-        for (const auto& rate : preset->frameRateRanges) {
-            updateMinMax(minimumFrameRate, maximumFrameRate, rate.minimum);
-            updateMinMax(minimumFrameRate, maximumFrameRate, rate.maximum);
-        }
+        for (const auto& rate : preset->frameRateRanges)
+            maximumFrameRate = std::max(maximumFrameRate, rate.maximum);
     }
 
     if (canResizeVideoFrames()) {
         minimumWidth = 1;
         minimumHeight = 1;
+        minimumAspectRatio = 1.0 / maximumHeight;
+        maximumAspectRatio = maximumWidth;
     }
 
     capabilities.setWidth({ minimumWidth, maximumWidth });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to