Title: [234949] trunk/Source/WebCore
Revision
234949
Author
[email protected]
Date
2018-08-16 12:50:34 -0700 (Thu, 16 Aug 2018)

Log Message

Change the input camera in the sources & outputs example on Safari (11) with M.Way camera
https://bugs.webkit.org/show_bug.cgi?id=187756
<rdar://problem/42332178>

Reviewed by Eric Carlson.

Covered by manual testing.

640x480x30fps is added as ideal constraints to getUserMedia if none other is added to provide consistent behavior.
Some cameras do not support 30fps as they have discrete frame rate ranges.
Before the patch, we were rejecting getUserMedia promise if the 'ideal' frameRate was not supported.
After the patch, we do not check whether frame rate is supported if it is not mandatory.
At capture time, we will still try to apply frame rate change and if not supported, the frame rate will not be set to 30 fps.

While we could surface discrete width/height/frame rate ranges, it seems best to fix the issue this way.
In the future, we might implement video interpolation for width/height/framerate at WebCore level.

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::supportsSizeAndFrameRate):
(WebCore::RealtimeMediaSource::supportsConstraint const):
(WebCore::RealtimeMediaSource::supportsConstraints):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234948 => 234949)


--- trunk/Source/WebCore/ChangeLog	2018-08-16 19:38:32 UTC (rev 234948)
+++ trunk/Source/WebCore/ChangeLog	2018-08-16 19:50:34 UTC (rev 234949)
@@ -1,3 +1,27 @@
+2018-08-16  Youenn Fablet  <[email protected]>
+
+        Change the input camera in the sources & outputs example on Safari (11) with M.Way camera
+        https://bugs.webkit.org/show_bug.cgi?id=187756
+        <rdar://problem/42332178>
+
+        Reviewed by Eric Carlson.
+
+        Covered by manual testing.
+
+        640x480x30fps is added as ideal constraints to getUserMedia if none other is added to provide consistent behavior.
+        Some cameras do not support 30fps as they have discrete frame rate ranges.
+        Before the patch, we were rejecting getUserMedia promise if the 'ideal' frameRate was not supported.
+        After the patch, we do not check whether frame rate is supported if it is not mandatory.
+        At capture time, we will still try to apply frame rate change and if not supported, the frame rate will not be set to 30 fps.
+
+        While we could surface discrete width/height/frame rate ranges, it seems best to fix the issue this way.
+        In the future, we might implement video interpolation for width/height/framerate at WebCore level.
+
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate):
+        (WebCore::RealtimeMediaSource::supportsConstraint const):
+        (WebCore::RealtimeMediaSource::supportsConstraints):
+
 2018-08-16  Ryosuke Niwa  <[email protected]>
 
         Perform a microtask checkpoint before creating a custom element

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (234948 => 234949)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2018-08-16 19:38:32 UTC (rev 234948)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2018-08-16 19:50:34 UTC (rev 234949)
@@ -246,8 +246,10 @@
         }
 
         distance = std::min(distance, constraintDistance);
-        auto range = capabilities.width();
-        width = widthConstraint->valueForCapabilityRange(size().width(), range.rangeMin().asInt, range.rangeMax().asInt);
+        if (widthConstraint->isMandatory()) {
+            auto range = capabilities.width();
+            width = widthConstraint->valueForCapabilityRange(size().width(), range.rangeMin().asInt, range.rangeMax().asInt);
+        }
     }
 
     std::optional<int> height;
@@ -259,8 +261,10 @@
         }
 
         distance = std::min(distance, constraintDistance);
-        auto range = capabilities.height();
-        height = heightConstraint->valueForCapabilityRange(size().height(), range.rangeMin().asInt, range.rangeMax().asInt);
+        if (heightConstraint->isMandatory()) {
+            auto range = capabilities.height();
+            height = heightConstraint->valueForCapabilityRange(size().height(), range.rangeMin().asInt, range.rangeMax().asInt);
+        }
     }
 
     std::optional<double> frameRate;
@@ -272,8 +276,10 @@
         }
 
         distance = std::min(distance, constraintDistance);
-        auto range = capabilities.frameRate();
-        frameRate = frameRateConstraint->valueForCapabilityRange(this->frameRate(), range.rangeMin().asDouble, range.rangeMax().asDouble);
+        if (frameRateConstraint->isMandatory()) {
+            auto range = capabilities.frameRate();
+            frameRate = frameRateConstraint->valueForCapabilityRange(this->frameRate(), range.rangeMin().asDouble, range.rangeMax().asDouble);
+        }
     }
 
     // Each of the non-null values is supported individually, see if they all can be applied at the same time.
@@ -286,7 +292,7 @@
             badConstraint = frameRateConstraint->name();
         return false;
     }
-    
+
     return true;
 }
 
@@ -754,7 +760,7 @@
         // Unknown (or unsupported) constraints should be ignored.
         break;
     }
-    
+
     return false;
 }
 
@@ -765,7 +771,7 @@
     FlattenedConstraint candidates;
     if (!selectSettings(constraints, candidates, invalidConstraint, SelectType::ForSupportsConstraints))
         return false;
-    
+
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to