[MediaStream] Update MediaStreamTrack.getCapabilities
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:34:55 +0000 (00:34 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:34:55 +0000 (00:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151728

Reviewed by Jer Noble.

Source/WebCore:

Test: fast/mediastream/MediaStreamTrack-getCapabilities.html

* CMakeLists.txt: Remove files deleted from the repository.

* DerivedSources.make: Ditto.

* Modules/mediastream/AllAudioCapabilities.h: Removed.
* Modules/mediastream/AllAudioCapabilities.idl: Removed.
* Modules/mediastream/AllVideoCapabilities.h: Removed.
* Modules/mediastream/AllVideoCapabilities.idl: Removed.
* Modules/mediastream/CapabilityRange.cpp: Removed.
* Modules/mediastream/CapabilityRange.h: Removed.
* Modules/mediastream/CapabilityRange.idl: Removed.

* Modules/mediastream/MediaSourceSettings.h:
(WebCore::MediaSourceSettings::supportsVolume): Volume is a double.
(WebCore::MediaSourceSettings::volume): Double.

* Modules/mediastream/MediaStreamCapabilities.cpp: Removed.
* Modules/mediastream/MediaStreamCapabilities.h: Removed.
* Modules/mediastream/MediaStreamCapabilities.idl: Removed.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::getCapabilities): MediaStreamCapabilities is gone, return a RealtimeMediaSourceCapabilities.
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:

* WebCore.xcodeproj/project.pbxproj: Remove files deleted from the repository.
* bindings/js/JSMediaStreamTrackCustom.cpp:
(WebCore::capabilityValue):
(WebCore::JSMediaStreamTrack::getCapabilities): Create and return a dictionary of capatilities.

* platform/mediastream/RealtimeMediaSourceCapabilities.h:
(WebCore::CapabilityValueOrRange::type):
(WebCore::CapabilityValueOrRange::CapabilityValueOrRange):
(WebCore::CapabilityValueOrRange::rangeMin):
(WebCore::CapabilityValueOrRange::rangeMax):
(WebCore::CapabilityValueOrRange::value):
(WebCore::RealtimeMediaSourceCapabilities::create):
(WebCore::RealtimeMediaSourceCapabilities::~RealtimeMediaSourceCapabilities):
(WebCore::RealtimeMediaSourceCapabilities::supportsWidth):
(WebCore::RealtimeMediaSourceCapabilities::width):
(WebCore::RealtimeMediaSourceCapabilities::setWidth):
(WebCore::RealtimeMediaSourceCapabilities::supportsHeight):
(WebCore::RealtimeMediaSourceCapabilities::height):
(WebCore::RealtimeMediaSourceCapabilities::setHeight):
(WebCore::RealtimeMediaSourceCapabilities::supportsFrameRate):
(WebCore::RealtimeMediaSourceCapabilities::frameRate):
(WebCore::RealtimeMediaSourceCapabilities::setFrameRate):
(WebCore::RealtimeMediaSourceCapabilities::supportsFacingMode):
(WebCore::RealtimeMediaSourceCapabilities::facingMode):
(WebCore::RealtimeMediaSourceCapabilities::addFacingMode):
(WebCore::RealtimeMediaSourceCapabilities::supportsAspectRatio):
(WebCore::RealtimeMediaSourceCapabilities::aspectRatio):
(WebCore::RealtimeMediaSourceCapabilities::setAspectRatio):
(WebCore::RealtimeMediaSourceCapabilities::supportsVolume):
(WebCore::RealtimeMediaSourceCapabilities::volume):
(WebCore::RealtimeMediaSourceCapabilities::setVolume):
(WebCore::RealtimeMediaSourceCapabilities::supportsSampleRate):
(WebCore::RealtimeMediaSourceCapabilities::sampleRate):
(WebCore::RealtimeMediaSourceCapabilities::setSampleRate):
(WebCore::RealtimeMediaSourceCapabilities::supportsSampleSize):
(WebCore::RealtimeMediaSourceCapabilities::sampleSize):
(WebCore::RealtimeMediaSourceCapabilities::setSampleSize):
(WebCore::RealtimeMediaSourceCapabilities::supportsEchoCancellation):
(WebCore::RealtimeMediaSourceCapabilities::echoCancellation):
(WebCore::RealtimeMediaSourceCapabilities::setEchoCancellation):
(WebCore::RealtimeMediaSourceCapabilities::supportsDeviceId):
(WebCore::RealtimeMediaSourceCapabilities::deviceId):
(WebCore::RealtimeMediaSourceCapabilities::setDeviceId):
(WebCore::RealtimeMediaSourceCapabilities::supportsGroupId):
(WebCore::RealtimeMediaSourceCapabilities::groupId):
(WebCore::RealtimeMediaSourceCapabilities::setGroupId):
(WebCore::RealtimeMediaSourceCapabilities::RealtimeMediaSourceCapabilities):
(WebCore::RealtimeMediaSourceCapabilityRange::RealtimeMediaSourceCapabilityRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilityRange::min): Deleted.
(WebCore::RealtimeMediaSourceCapabilityRange::max): Deleted.
(WebCore::RealtimeMediaSourceCapabilityRange::type): Deleted.
(WebCore::RealtimeMediaSourceCapabilityRange::supported): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::sourceId): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setSourceId): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::facingModes): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setWidthRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setHeightRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setFrameRateRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setAspectRatioRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setVolumeRange): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::hasVideoSource): Deleted.
(WebCore::RealtimeMediaSourceCapabilities::setHasVideoSource): Deleted.

* platform/mediastream/RealtimeMediaSourceSettings.h:
(WebCore::RealtimeMediaSourceSettings::volume): Volume is a double.
(WebCore::RealtimeMediaSourceSettings::setVolume): Ditt.

* platform/mediastream/mac/AVAudioCaptureSource.mm:
(WebCore::AVAudioCaptureSource::initializeCapabilities): Initialize volume capability.

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::capabilities): RealtimeMediaSourceCapabilities constructor takes
  supportedConstraints. sourceId -> deviceId.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::initializeCapabilities): DeviceId is set by the base class.

* platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: Drive-by cleanup, remove unused code.

* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::initializeCapabilities): Updated.
(WebCore::MockRealtimeAudioSource::initializeSupportedConstraints): Ditto.

* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::capabilities): sourceId -> deviceId.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::initializeCapabilities): Updated.
(WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.

LayoutTests:

* fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: Added.
* fast/mediastream/MediaStreamTrack-getCapabilities.html: Added.
* fast/mediastream/MediaStreamTrack-getSettings-expected.txt:
* fast/mediastream/MediaStreamTrack-getSettings.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities.html [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-getSettings-expected.txt
LayoutTests/fast/mediastream/MediaStreamTrack-getSettings.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/mediastream/AllAudioCapabilities.h [deleted file]
Source/WebCore/Modules/mediastream/AllAudioCapabilities.idl [deleted file]
Source/WebCore/Modules/mediastream/AllVideoCapabilities.h [deleted file]
Source/WebCore/Modules/mediastream/AllVideoCapabilities.idl [deleted file]
Source/WebCore/Modules/mediastream/CapabilityRange.cpp [deleted file]
Source/WebCore/Modules/mediastream/CapabilityRange.h [deleted file]
Source/WebCore/Modules/mediastream/CapabilityRange.idl [deleted file]
Source/WebCore/Modules/mediastream/MediaSourceSettings.h
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp [deleted file]
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.h [deleted file]
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl [deleted file]
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/MediaStreamTrack.idl
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSourceCapabilities.h
Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h
Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm
Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm
Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp

index f037f2d..2089baa 100644 (file)
@@ -1,3 +1,15 @@
+2015-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        [MediaStream] Update MediaStreamTrack.getCapabilities
+        https://bugs.webkit.org/show_bug.cgi?id=151728
+
+        Reviewed by Jer Noble.
+
+        * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: Added.
+        * fast/mediastream/MediaStreamTrack-getCapabilities.html: Added.
+        * fast/mediastream/MediaStreamTrack-getSettings-expected.txt:
+        * fast/mediastream/MediaStreamTrack-getSettings.html:
+
 2015-12-03  Ryan Haddad  <ryanhaddad@apple.com>
 
         Removing deleted test storage/indexeddb/objectstore-keycursor.html from TestExpectations file
diff --git a/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt b/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt
new file mode 100644 (file)
index 0000000..98b9345
--- /dev/null
@@ -0,0 +1,22 @@
+Tests MediaStreamTrack.getCapabilities.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+video track capabilities:
+  capabilities.width = { min: 320, max: 1920 }
+  capabilities.height = { min: 240, max: 1080 }
+  capabilities.aspectRatio = { min: 1.333, max: 1.778 }
+  capabilities.frameRate = { min: 15, max: 60 }
+  capabilities.facingMode = [ user, environment ]
+  capabilities.deviceId = <UUID>
+
+audio track capabilities:
+  capabilities.volume = { min: 0, max: 1 }
+  capabilities.echoCancellation = [ true, true ]
+  capabilities.deviceId = <UUID>
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities.html b/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities.html
new file mode 100644 (file)
index 0000000..024554e
--- /dev/null
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script src="./resources/getUserMedia-helper.js"></script>
+        <script>
+            var mediaStream;
+
+            function limitPrecision(value, precision)
+            {
+                if (typeof value === "string")
+                    return `"${value}`;
+
+                if (typeof value === "number" && value % 1 != 0)
+                    return value.toFixed(precision);
+                return value;
+            }
+
+            function capabilityRange(name, object)
+            {
+                if (Array.isArray(object)) {
+                    if (!object.length)
+                        return "[ ]";
+
+                    var value = "[";
+                    for (i = 0; i < object.length; i++)
+                        value += ` ${object[i]},`;
+
+                    return value.slice(0, -1) + " ]";
+                }
+
+                var value = "{";
+                for (var property in object) {
+                        value += ` ${property}: ${limitPrecision(object[property], 3)},`;
+                }
+                
+                if (value.length)
+                    value = value.slice(0, -1);
+
+
+                return value + " }";
+            }
+
+            function listTrackProperties(track)
+            {
+                debug(`${track.kind} track capabilities:`);
+                capabilities = track.getCapabilities();
+                for (var property in capabilities) {
+                    if (capabilities.hasOwnProperty(property) || capabilities.__proto__.hasOwnProperty(property))
+                        if (property == "deviceId")
+                            value = "&lt;UUID>";
+                        else if (typeof capabilities[property] === "object")
+                            value = capabilityRange(property, capabilities[property]);
+                        else
+                            value = limitPrecision(capabilities[property], 2);
+                        debug(`  capabilities.${property} = ${value}`);
+                }
+                debug("");
+            }
+
+            function gotStream(stream)
+            {
+                mediaStream = stream;
+                listTrackProperties(mediaStream.getVideoTracks()[0]);
+                listTrackProperties(mediaStream.getAudioTracks()[0]);
+                finishJSTest();
+            }
+
+            function start()
+            {
+                description("Tests MediaStreamTrack.getCapabilities.");
+                getUserMedia("allow", {audio:true, video:true}, gotStream);
+            }
+
+            window.jsTestIsAsync = true;
+            window.successfullyParsed = true;
+        </script>
+
+    </head>
+    <body onload="start()">
+        <p id="description"></p>
+        <div id="console"></div>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
index d393aca..41c7f42 100644 (file)
@@ -3,18 +3,30 @@ Tests MediaStreamTrack.getSettings.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-video track:
+video track settings:
   settings.width = 640
   settings.height = 480
-  settings.aspectRatio = 1.33
+  settings.aspectRatio = 1.333
   settings.frameRate = 30
   settings.facingMode = user
   settings.deviceId = <UUID>
 
-audio track:
+audio track settings:
   settings.volume = 50
+  settings.echoCancellation = false
   settings.deviceId = <UUID>
 
+According to the spec: "[every setting] MUST be a member of the set defined for that property by getCapabilities()"
+
+PASS "width" in track.getCapabilities() is true
+PASS "height" in track.getCapabilities() is true
+PASS "aspectRatio" in track.getCapabilities() is true
+PASS "frameRate" in track.getCapabilities() is true
+PASS "facingMode" in track.getCapabilities() is true
+PASS "deviceId" in track.getCapabilities() is true
+PASS "volume" in track.getCapabilities() is true
+PASS "echoCancellation" in track.getCapabilities() is true
+PASS "deviceId" in track.getCapabilities() is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 83cbf21..b35fbd3 100644 (file)
@@ -5,6 +5,7 @@
         <script src="./resources/getUserMedia-helper.js"></script>
         <script>
             var mediaStream;
+            var track;
 
             function limitPrecision(value, precision)
             {
                 return value;
             }
             
-            function listTrackProperties(track)
+            function listTrackSettings(track)
             {
-                debug(`${track.kind} track:`);
+                debug(`${track.kind} track settings:`);
                 settings = track.getSettings();
                 for (var property in settings) {
-                    if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property))
+                    if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) {
                         if (property == "deviceId")
                             value = "&lt;UUID>";
                         else
-                            value = limitPrecision(settings[property], 2);
+                            value = limitPrecision(settings[property], 3);
                         debug(`  settings.${property} = ${value}`);
+                    }
                 }
+
                 debug("");
             }
 
+            function checkTrackSettings(t)
+            {
+                track = t;
+
+                capabilities = track.getCapabilities();
+                settings = track.getSettings();
+                for (var property in settings) {
+                    if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) {
+                        shouldBeTrue(`"${property}" in track.getCapabilities()`);
+                    }
+                }
+            }
+
             function gotStream(stream)
             {
                 mediaStream = stream;
-                listTrackProperties(mediaStream.getVideoTracks()[0]);
-                listTrackProperties(mediaStream.getAudioTracks()[0]);
+
+                listTrackSettings(mediaStream.getVideoTracks()[0]);
+                listTrackSettings(mediaStream.getAudioTracks()[0]);
+
+                debug('According to the spec: "[every setting] MUST be a member of the set defined for that property by getCapabilities()"<br>');
+                checkTrackSettings(mediaStream.getVideoTracks()[0]);
+                checkTrackSettings(mediaStream.getAudioTracks()[0]);
                 finishJSTest();
             }
 
index cddfe97..d27b4bd 100644 (file)
@@ -221,15 +221,11 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/mediasource/SourceBufferList.idl
     Modules/mediasource/VideoPlaybackQuality.idl
 
-    Modules/mediastream/AllAudioCapabilities.idl
-    Modules/mediastream/AllVideoCapabilities.idl
-    Modules/mediastream/CapabilityRange.idl
     Modules/mediastream/DOMURLMediaStream.idl
     Modules/mediastream/HTMLMediaElementMediaStream.idl
     Modules/mediastream/MediaDeviceInfo.idl
     Modules/mediastream/MediaDevices.idl
     Modules/mediastream/MediaStream.idl
-    Modules/mediastream/MediaStreamCapabilities.idl
     Modules/mediastream/MediaStreamEvent.idl
     Modules/mediastream/MediaStreamTrack.idl
     Modules/mediastream/MediaStreamTrackEvent.idl
@@ -943,7 +939,6 @@ set(WebCore_SOURCES
     Modules/mediasource/SourceBufferList.cpp
     Modules/mediasource/VideoPlaybackQuality.cpp
 
-    Modules/mediastream/CapabilityRange.cpp
     Modules/mediastream/DOMURLMediaStream.cpp
     Modules/mediastream/HTMLMediaElementMediaStream.cpp
     Modules/mediastream/MediaConstraintsImpl.cpp
@@ -953,7 +948,6 @@ set(WebCore_SOURCES
     Modules/mediastream/MediaEndpointPeerConnection.cpp
     Modules/mediastream/MediaSourceSettings.cpp
     Modules/mediastream/MediaStream.cpp
-    Modules/mediastream/MediaStreamCapabilities.cpp
     Modules/mediastream/MediaStreamEvent.cpp
     Modules/mediastream/MediaStreamRegistry.cpp
     Modules/mediastream/MediaStreamTrack.cpp
@@ -1206,7 +1200,6 @@ set(WebCore_SOURCES
     bindings/js/JSLazyEventListener.cpp
     bindings/js/JSLocationCustom.cpp
     bindings/js/JSMainThreadExecState.cpp
-    bindings/js/JSMediaStreamCapabilitiesCustom.cpp
     bindings/js/JSMediaStreamTrackCustom.cpp
     bindings/js/JSMediaTrackSupportedConstraintsCustom.cpp
     bindings/js/JSMessageChannelCustom.cpp
index e0ef7dd..ce649b9 100644 (file)
@@ -1,3 +1,127 @@
+2015-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        [MediaStream] Update MediaStreamTrack.getCapabilities
+        https://bugs.webkit.org/show_bug.cgi?id=151728
+
+        Reviewed by Jer Noble.
+
+        Test: fast/mediastream/MediaStreamTrack-getCapabilities.html
+
+        * CMakeLists.txt: Remove files deleted from the repository.
+
+        * DerivedSources.make: Ditto.
+
+        * Modules/mediastream/AllAudioCapabilities.h: Removed.
+        * Modules/mediastream/AllAudioCapabilities.idl: Removed.
+        * Modules/mediastream/AllVideoCapabilities.h: Removed.
+        * Modules/mediastream/AllVideoCapabilities.idl: Removed.
+        * Modules/mediastream/CapabilityRange.cpp: Removed.
+        * Modules/mediastream/CapabilityRange.h: Removed.
+        * Modules/mediastream/CapabilityRange.idl: Removed.
+
+        * Modules/mediastream/MediaSourceSettings.h:
+        (WebCore::MediaSourceSettings::supportsVolume): Volume is a double.
+        (WebCore::MediaSourceSettings::volume): Double.
+
+        * Modules/mediastream/MediaStreamCapabilities.cpp: Removed.
+        * Modules/mediastream/MediaStreamCapabilities.h: Removed.
+        * Modules/mediastream/MediaStreamCapabilities.idl: Removed.
+
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::getCapabilities): MediaStreamCapabilities is gone, return a RealtimeMediaSourceCapabilities.
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/MediaStreamTrack.idl:
+
+        * WebCore.xcodeproj/project.pbxproj: Remove files deleted from the repository.
+        * bindings/js/JSMediaStreamTrackCustom.cpp:
+        (WebCore::capabilityValue):
+        (WebCore::JSMediaStreamTrack::getCapabilities): Create and return a dictionary of capatilities.
+
+        * platform/mediastream/RealtimeMediaSourceCapabilities.h:
+        (WebCore::CapabilityValueOrRange::type):
+        (WebCore::CapabilityValueOrRange::CapabilityValueOrRange):
+        (WebCore::CapabilityValueOrRange::rangeMin):
+        (WebCore::CapabilityValueOrRange::rangeMax):
+        (WebCore::CapabilityValueOrRange::value):
+        (WebCore::RealtimeMediaSourceCapabilities::create):
+        (WebCore::RealtimeMediaSourceCapabilities::~RealtimeMediaSourceCapabilities):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsWidth):
+        (WebCore::RealtimeMediaSourceCapabilities::width):
+        (WebCore::RealtimeMediaSourceCapabilities::setWidth):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsHeight):
+        (WebCore::RealtimeMediaSourceCapabilities::height):
+        (WebCore::RealtimeMediaSourceCapabilities::setHeight):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsFrameRate):
+        (WebCore::RealtimeMediaSourceCapabilities::frameRate):
+        (WebCore::RealtimeMediaSourceCapabilities::setFrameRate):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsFacingMode):
+        (WebCore::RealtimeMediaSourceCapabilities::facingMode):
+        (WebCore::RealtimeMediaSourceCapabilities::addFacingMode):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsAspectRatio):
+        (WebCore::RealtimeMediaSourceCapabilities::aspectRatio):
+        (WebCore::RealtimeMediaSourceCapabilities::setAspectRatio):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsVolume):
+        (WebCore::RealtimeMediaSourceCapabilities::volume):
+        (WebCore::RealtimeMediaSourceCapabilities::setVolume):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsSampleRate):
+        (WebCore::RealtimeMediaSourceCapabilities::sampleRate):
+        (WebCore::RealtimeMediaSourceCapabilities::setSampleRate):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsSampleSize):
+        (WebCore::RealtimeMediaSourceCapabilities::sampleSize):
+        (WebCore::RealtimeMediaSourceCapabilities::setSampleSize):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsEchoCancellation):
+        (WebCore::RealtimeMediaSourceCapabilities::echoCancellation):
+        (WebCore::RealtimeMediaSourceCapabilities::setEchoCancellation):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsDeviceId):
+        (WebCore::RealtimeMediaSourceCapabilities::deviceId):
+        (WebCore::RealtimeMediaSourceCapabilities::setDeviceId):
+        (WebCore::RealtimeMediaSourceCapabilities::supportsGroupId):
+        (WebCore::RealtimeMediaSourceCapabilities::groupId):
+        (WebCore::RealtimeMediaSourceCapabilities::setGroupId):
+        (WebCore::RealtimeMediaSourceCapabilities::RealtimeMediaSourceCapabilities):
+        (WebCore::RealtimeMediaSourceCapabilityRange::RealtimeMediaSourceCapabilityRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilityRange::min): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilityRange::max): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilityRange::type): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilityRange::supported): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::sourceId): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setSourceId): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::facingModes): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setWidthRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setHeightRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setFrameRateRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setAspectRatioRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setVolumeRange): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::hasVideoSource): Deleted.
+        (WebCore::RealtimeMediaSourceCapabilities::setHasVideoSource): Deleted.
+
+        * platform/mediastream/RealtimeMediaSourceSettings.h:
+        (WebCore::RealtimeMediaSourceSettings::volume): Volume is a double.
+        (WebCore::RealtimeMediaSourceSettings::setVolume): Ditt.
+
+        * platform/mediastream/mac/AVAudioCaptureSource.mm:
+        (WebCore::AVAudioCaptureSource::initializeCapabilities): Initialize volume capability.
+
+        * platform/mediastream/mac/AVMediaCaptureSource.mm:
+        (WebCore::AVMediaCaptureSource::capabilities): RealtimeMediaSourceCapabilities constructor takes
+          supportedConstraints. sourceId -> deviceId.
+
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::initializeCapabilities): DeviceId is set by the base class.
+
+        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: Drive-by cleanup, remove unused code.
+
+        * platform/mock/MockRealtimeAudioSource.cpp:
+        (WebCore::MockRealtimeAudioSource::initializeCapabilities): Updated.
+        (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints): Ditto.
+
+        * platform/mock/MockRealtimeMediaSource.cpp:
+        (WebCore::MockRealtimeMediaSource::capabilities): sourceId -> deviceId.
+
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::initializeCapabilities): Updated.
+        (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
+
 2015-12-03  Simon Fraser  <simon.fraser@apple.com>
 
         Have layer memory use consult the backing store format
index 611f33c..a4f5737 100644 (file)
@@ -117,15 +117,11 @@ NON_SVG_BINDING_IDLS = \
        $(WebCore)/Modules/mediasource/TextTrackMediaSource.idl \
        $(WebCore)/Modules/mediasource/VideoTrackMediaSource.idl \
        $(WebCore)/Modules/mediasource/VideoPlaybackQuality.idl \
-       $(WebCore)/Modules/mediastream/AllVideoCapabilities.idl \
-       $(WebCore)/Modules/mediastream/AllAudioCapabilities.idl \
-    $(WebCore)/Modules/mediastream/CapabilityRange.idl \
        $(WebCore)/Modules/mediastream/DOMURLMediaStream.idl \
     $(WebCore)/Modules/mediastream/HTMLMediaElementMediaStream.idl \
     $(WebCore)/Modules/mediastream/MediaDeviceInfo.idl \
     $(WebCore)/Modules/mediastream/MediaDevices.idl \
        $(WebCore)/Modules/mediastream/MediaStream.idl \
-       $(WebCore)/Modules/mediastream/MediaStreamCapabilities.idl \
     $(WebCore)/Modules/mediastream/MediaStreamEvent.idl \
     $(WebCore)/Modules/mediastream/MediaStreamTrack.idl \
     $(WebCore)/Modules/mediastream/MediaStreamTrackEvent.idl \
diff --git a/Source/WebCore/Modules/mediastream/AllAudioCapabilities.h b/Source/WebCore/Modules/mediastream/AllAudioCapabilities.h
deleted file mode 100644 (file)
index 9fc8397..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AllAudioCapabilities_h
-#define AllAudioCapabilities_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStreamCapabilities.h"
-#include "RealtimeMediaSourceCapabilities.h"
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class CapabilityRange;
-class RealtimeMediaSourceCapabilities;
-
-class AllAudioCapabilities : public MediaStreamCapabilities {
-public:
-    static Ref<AllAudioCapabilities> create(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-    {
-        return adoptRef(*new AllAudioCapabilities(capabilities));
-    }
-    virtual ~AllAudioCapabilities() { }
-
-private:
-    explicit AllAudioCapabilities(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-        : MediaStreamCapabilities(capabilities)
-    {
-    }
-};
-
-} // namespace WebCore
-
-#endif // AllAudioCapabilities_h
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/AllAudioCapabilities.idl b/Source/WebCore/Modules/mediastream/AllAudioCapabilities.idl
deleted file mode 100644 (file)
index 0d1077a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-[
-    NoInterfaceObject,
-    Conditional=MEDIA_STREAM,
-    JSGenerateToJSObject,
-] interface AllAudioCapabilities : MediaStreamCapabilities {
-    readonly attribute DOMString[] sourceId;
-    readonly attribute CapabilityRange volume;
-};
diff --git a/Source/WebCore/Modules/mediastream/AllVideoCapabilities.h b/Source/WebCore/Modules/mediastream/AllVideoCapabilities.h
deleted file mode 100644 (file)
index 0187c30..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AllVideoCapabilities_h
-#define AllVideoCapabilities_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStreamCapabilities.h"
-
-namespace WebCore {
-
-class CapabilityRange;
-class RealtimeMediaSourceCapabilities;
-
-class AllVideoCapabilities : public MediaStreamCapabilities {
-public:
-    static Ref<AllVideoCapabilities> create(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-    {
-        return adoptRef(*new AllVideoCapabilities(capabilities));
-    }
-    virtual ~AllVideoCapabilities() { }
-
-private:
-    explicit AllVideoCapabilities(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-        : MediaStreamCapabilities(capabilities)
-    {
-    }
-};
-
-} // namespace WebCore
-
-#endif // AllVideoCapabilities_h
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/AllVideoCapabilities.idl b/Source/WebCore/Modules/mediastream/AllVideoCapabilities.idl
deleted file mode 100644 (file)
index 4b07d00..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-[
-    NoInterfaceObject,
-    Conditional=MEDIA_STREAM,
-    JSGenerateToJSObject,
-] interface AllVideoCapabilities : MediaStreamCapabilities {
-    readonly attribute DOMString[] sourceType;
-    readonly attribute DOMString[] sourceId;
-    readonly attribute CapabilityRange width;
-    readonly attribute CapabilityRange height;
-    readonly attribute CapabilityRange frameRate;
-    readonly attribute CapabilityRange aspectRatio;
-    readonly attribute DOMString[]  facingMode;
-};
diff --git a/Source/WebCore/Modules/mediastream/CapabilityRange.cpp b/Source/WebCore/Modules/mediastream/CapabilityRange.cpp
deleted file mode 100644 (file)
index 994025f..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#include "config.h"
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "CapabilityRange.h"
-
-#include "JSDOMBinding.h"
-#include "MediaSourceSettings.h"
-#include <bindings/ScriptValue.h>
-#include <interpreter/CallFrame.h>
-#include <runtime/JSCJSValue.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-Ref<CapabilityRange> CapabilityRange::create(const RealtimeMediaSourceCapabilityRange& rangeInfo)
-{
-    return adoptRef(*new CapabilityRange(rangeInfo));
-}
-
-CapabilityRange::CapabilityRange(const RealtimeMediaSourceCapabilityRange& rangeInfo)
-    : m_rangeInfo(rangeInfo)
-{
-}
-
-static Deprecated::ScriptValue scriptValue(ExecState& state, const RealtimeMediaSourceCapabilityRange::ValueUnion& value, RealtimeMediaSourceCapabilityRange::Type type)
-{
-    // NOTE: the spec says:
-    //      ... an implementation should make a reasonable attempt to translate and scale the hardware's setting
-    //      onto the mapping provided by this specification. If this is not possible due to the user agent's
-    //      inability to retrieve a given capability from a source, then for CapabilityRange-typed capabilities,
-    //      the min and max fields will not be present on the returned dictionary, and the supported field will be false.
-    // We don't do this currently because I don't know of an instance where it isn't possible to retrieve a source
-    // capability, but when we have to deal with this we will need to mark CapabilityRange.min and CapabilityRange.max as
-    // "Custom" and return jsUndefined() from the custom getter to support it.
-    
-    switch (type) {
-    case RealtimeMediaSourceCapabilityRange::Float:
-        return Deprecated::ScriptValue(state.vm(), JSValue(value.asFloat));
-        break;
-    case RealtimeMediaSourceCapabilityRange::ULong:
-        return Deprecated::ScriptValue(state.vm(), JSValue(value.asULong));
-        break;
-    case RealtimeMediaSourceCapabilityRange::Undefined:
-        return Deprecated::ScriptValue(state.vm(), jsUndefined());
-        break;
-    }
-
-    ASSERT_NOT_REACHED();
-    return Deprecated::ScriptValue(state.vm(), jsUndefined());
-}
-
-Deprecated::ScriptValue CapabilityRange::min(ExecState& state) const
-{
-    return scriptValue(state, m_rangeInfo.min(), m_rangeInfo.type());
-}
-
-Deprecated::ScriptValue CapabilityRange::max(ExecState& state) const
-{
-    return scriptValue(state, m_rangeInfo.max(), m_rangeInfo.type());
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/CapabilityRange.h b/Source/WebCore/Modules/mediastream/CapabilityRange.h
deleted file mode 100644 (file)
index c041485..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- */
-
-#ifndef CapabilityRange_h
-#define CapabilityRange_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "RealtimeMediaSourceCapabilities.h"
-#include "ScriptWrappable.h"
-#include <bindings/ScriptValue.h>
-#include <interpreter/CallFrame.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class CapabilityRange : public RefCounted<CapabilityRange>, public ScriptWrappable {
-public:
-    virtual ~CapabilityRange() { }
-
-    static Ref<CapabilityRange> create(const RealtimeMediaSourceCapabilityRange&);
-
-    Deprecated::ScriptValue min(JSC::ExecState&) const;
-    Deprecated::ScriptValue max(JSC::ExecState&) const;
-    bool supported() const { return m_rangeInfo.supported(); }
-
-private:
-    CapabilityRange(const RealtimeMediaSourceCapabilityRange&);
-    
-    RealtimeMediaSourceCapabilityRange m_rangeInfo;
-};
-
-} // namespace WebCore
-
-#endif // CapabilityRange_h
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/CapabilityRange.idl b/Source/WebCore/Modules/mediastream/CapabilityRange.idl
deleted file mode 100644 (file)
index 0ba1b3a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-[
-    NoInterfaceObject,
-    Conditional=MEDIA_STREAM,
-] interface CapabilityRange {
-    [CallWith=ScriptState] readonly attribute any max;
-    [CallWith=ScriptState] readonly attribute any min;
-    readonly attribute boolean supported;
-};
index 8a1d164..b9f2811 100644 (file)
@@ -55,7 +55,7 @@ public:
     const AtomicString& facingMode() const;
 
     bool supportsVolume() const { return m_sourceSettings.supportsVolume(); }
-    unsigned long volume() const { return m_sourceSettings.volume(); }
+    double volume() const { return m_sourceSettings.volume(); }
 
     bool supportsSampleRate() const { return m_sourceSettings.supportsSampleRate(); }
     unsigned long sampleRate() const { return m_sourceSettings.sampleRate(); }
diff --git a/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp b/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp
deleted file mode 100644 (file)
index 3cac2ac..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStreamCapabilities.h"
-
-#include "AllAudioCapabilities.h"
-#include "AllVideoCapabilities.h"
-#include "CapabilityRange.h"
-#include "MediaSourceSettings.h"
-#include "RealtimeMediaSourceCapabilities.h"
-
-namespace WebCore {
-
-RefPtr<MediaStreamCapabilities> MediaStreamCapabilities::create(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-{
-    if (capabilities->hasVideoSource())
-        return AllVideoCapabilities::create(capabilities);
-    
-    return AllAudioCapabilities::create(capabilities);
-}
-
-MediaStreamCapabilities::MediaStreamCapabilities(PassRefPtr<RealtimeMediaSourceCapabilities> capabilities)
-    : m_SourceCapabilities(capabilities)
-{
-}
-
-Vector<String> MediaStreamCapabilities::sourceType() const
-{
-    // This will be fixed by https://bugs.webkit.org/show_bug.cgi?id=151728.
-    return Vector<String>();
-}
-
-Vector<String> MediaStreamCapabilities::sourceId() const
-{
-    size_t count = m_SourceCapabilities->sourceId().size();
-    if (!count)
-        return Vector<String>();
-
-    Vector<String> capabilities;
-    capabilities.reserveCapacity(count);
-
-    for (auto& id : m_SourceCapabilities->sourceId())
-        capabilities.append(id);
-    
-    return capabilities;
-}
-
-Vector<String> MediaStreamCapabilities::facingMode() const
-{
-    ASSERT(m_SourceCapabilities->hasVideoSource());
-    
-    size_t count = m_SourceCapabilities->facingModes().size();
-    if (!count)
-        return Vector<String>();
-    
-    Vector<String> capabilities;
-    capabilities.reserveCapacity(count);
-    
-    for (auto& mode : m_SourceCapabilities->facingModes())
-        capabilities.append(RealtimeMediaSourceSettings::facingMode(mode));
-    
-    return capabilities;
-}
-
-RefPtr<CapabilityRange> MediaStreamCapabilities::width() const
-{
-    ASSERT(m_SourceCapabilities->hasVideoSource());
-    
-    return CapabilityRange::create(m_SourceCapabilities->width());
-}
-
-RefPtr<CapabilityRange> MediaStreamCapabilities::height() const
-{
-    ASSERT(m_SourceCapabilities->hasVideoSource());
-    
-    return CapabilityRange::create(m_SourceCapabilities->height());
-}
-
-RefPtr<CapabilityRange> MediaStreamCapabilities::frameRate() const
-{
-    ASSERT(m_SourceCapabilities->hasVideoSource());
-    
-    return CapabilityRange::create(m_SourceCapabilities->frameRate());
-}
-
-RefPtr<CapabilityRange> MediaStreamCapabilities::aspectRatio() const
-{
-    ASSERT(m_SourceCapabilities->hasVideoSource());
-    
-    return CapabilityRange::create(m_SourceCapabilities->aspectRatio());
-}
-
-RefPtr<CapabilityRange> MediaStreamCapabilities::volume() const
-{
-    ASSERT(!m_SourceCapabilities->hasVideoSource());
-    
-    return CapabilityRange::create(m_SourceCapabilities->volume());
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.h b/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.h
deleted file mode 100644 (file)
index c4d4e13..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MediaStreamCapabilities_h
-#define MediaStreamCapabilities_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStreamCapabilities.h"
-#include "RealtimeMediaSourceCapabilities.h"
-#include "ScriptWrappable.h"
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class CapabilityRange;
-class RealtimeMediaSourceCapabilities;
-
-class MediaStreamCapabilities : public RefCounted<MediaStreamCapabilities>, public ScriptWrappable {
-public:
-    static RefPtr<MediaStreamCapabilities> create(PassRefPtr<RealtimeMediaSourceCapabilities>);
-    virtual ~MediaStreamCapabilities() { }
-
-    virtual Vector<String> sourceType() const;
-    virtual Vector<String> sourceId() const;
-    virtual RefPtr<CapabilityRange> width() const;
-    virtual RefPtr<CapabilityRange> height() const;
-    virtual RefPtr<CapabilityRange> frameRate() const;
-    virtual RefPtr<CapabilityRange> aspectRatio() const;
-    virtual Vector<String> facingMode() const;
-    virtual RefPtr<CapabilityRange> volume() const;
-    
-    bool hasVideoSource() { return m_SourceCapabilities->hasVideoSource(); }
-
-protected:
-    explicit MediaStreamCapabilities(PassRefPtr<RealtimeMediaSourceCapabilities>);
-
-    RefPtr<RealtimeMediaSourceCapabilities> m_SourceCapabilities;
-};
-
-} // namespace WebCore
-
-#endif // MediaStreamCapabilities_h
-
-#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl b/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl
deleted file mode 100644 (file)
index 4120292..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-[
-    Conditional=MEDIA_STREAM,
-    NoInterfaceObject,
-    SkipVTableValidation,
-    CustomToJSObject,
-] interface MediaStreamCapabilities {
-};
-
index 2985945..76cc057 100644 (file)
@@ -30,8 +30,6 @@
 
 #if ENABLE(MEDIA_STREAM)
 
-#include "AllAudioCapabilities.h"
-#include "AllVideoCapabilities.h"
 #include "Dictionary.h"
 #include "Event.h"
 #include "ExceptionCode.h"
@@ -167,9 +165,9 @@ RefPtr<MediaSourceSettings> MediaStreamTrack::getSettings() const
     return MediaSourceSettings::create(m_private->settings());
 }
 
-RefPtr<MediaStreamCapabilities> MediaStreamTrack::getCapabilities() const
+RefPtr<RealtimeMediaSourceCapabilities> MediaStreamTrack::getCapabilities() const
 {
-    return MediaStreamCapabilities::create(m_private->capabilities());
+    return m_private->capabilities();
 }
 
 void MediaStreamTrack::applyConstraints(const Dictionary& constraints)
index 17798fd..e249c30 100644 (file)
@@ -46,7 +46,6 @@ class AudioSourceProvider;
 class Dictionary;
 class MediaConstraintsImpl;
 class MediaSourceSettings;
-class MediaStreamCapabilities;
 class MediaTrackConstraints;
 
 class MediaStreamTrack final : public RefCounted<MediaStreamTrack>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public MediaStreamTrackPrivate::Observer {
@@ -80,7 +79,7 @@ public:
 
     RefPtr<MediaTrackConstraints> getConstraints() const;
     RefPtr<MediaSourceSettings> getSettings() const;
-    RefPtr<MediaStreamCapabilities> getCapabilities() const;
+    RefPtr<RealtimeMediaSourceCapabilities> getCapabilities() const;
     void applyConstraints(const Dictionary&);
     void applyConstraints(const MediaConstraints&);
 
index 72b3d0b..338f632 100644 (file)
@@ -48,7 +48,7 @@ enum MediaStreamTrackState { "new", "live", "ended" };
 
     MediaTrackConstraints getConstraints();
     [Custom] MediaSourceSettings getSettings();
-    MediaStreamCapabilities getCapabilities(); // returns either AllVideoCapabilities or AllAudioCapabilities
+    [Custom] MediaTrackCapabilities getCapabilities();
     void applyConstraints(Dictionary constraints);
 
     attribute EventHandler onoverconstrained;
index 6ab1155..6ff8229 100644 (file)
                070363E5181A1CDC00C074A5 /* AVMediaCaptureSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 070363DD181A1CDC00C074A5 /* AVMediaCaptureSource.mm */; };
                070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 070363DE181A1CDC00C074A5 /* AVVideoCaptureSource.h */; };
                070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 070363DF181A1CDC00C074A5 /* AVVideoCaptureSource.mm */; };
-               070584FF17F9F05E005F2BCB /* CapabilityRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070584FE17F9F05E005F2BCB /* CapabilityRange.cpp */; };
-               0705850217FA10D0005F2BCB /* JSAllVideoCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705850017FA10D0005F2BCB /* JSAllVideoCapabilities.cpp */; };
-               0705850317FA10D0005F2BCB /* JSAllVideoCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705850117FA10D0005F2BCB /* JSAllVideoCapabilities.h */; };
-               0705850817FA4689005F2BCB /* AllAudioCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705850517FA4689005F2BCB /* AllAudioCapabilities.h */; };
-               0705850B17FA4827005F2BCB /* MediaStreamCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705850A17FA4827005F2BCB /* MediaStreamCapabilities.h */; };
-               0705851217FA7107005F2BCB /* JSMediaStreamCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705851017FA7107005F2BCB /* JSMediaStreamCapabilities.cpp */; };
-               0705851317FA7107005F2BCB /* JSMediaStreamCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705851117FA7107005F2BCB /* JSMediaStreamCapabilities.h */; };
-               0705851517FB0EEA005F2BCB /* MediaStreamCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705851417FB0E2C005F2BCB /* MediaStreamCapabilities.cpp */; };
-               0705851717FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */; };
-               0705851A17FB44B4005F2BCB /* JSAllAudioCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705851817FB44B4005F2BCB /* JSAllAudioCapabilities.cpp */; };
-               0705851B17FB44B4005F2BCB /* JSAllAudioCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705851917FB44B4005F2BCB /* JSAllAudioCapabilities.h */; };
                0705852117FDC140005F2BCB /* MediaTrackConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705851D17FDC140005F2BCB /* MediaTrackConstraint.h */; };
                0705852317FDC140005F2BCB /* MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705851F17FDC140005F2BCB /* MediaTrackConstraints.cpp */; };
                0705852417FDC140005F2BCB /* MediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705852017FDC140005F2BCB /* MediaTrackConstraints.h */; };
                073794FE19F5864E00E5A045 /* RTCNotifiersMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F819F5864E00E5A045 /* RTCNotifiersMock.h */; };
                07394EC81BAB2CCD00BE99CD /* MediaDevicesRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */; };
                07394ECA1BAB2CD700BE99CD /* MediaDevicesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */; };
-               073AB4B317F8BACA006E0D6F /* AllVideoCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 073AB4B017F8BACA006E0D6F /* AllVideoCapabilities.h */; };
-               073AB4B717F92ECF006E0D6F /* JSCapabilityRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 073AB4B517F92ECF006E0D6F /* JSCapabilityRange.cpp */; };
-               073AB4B817F92ECF006E0D6F /* JSCapabilityRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 073AB4B617F92ECF006E0D6F /* JSCapabilityRange.h */; };
                073BE34017D17E01002BD431 /* JSNavigatorUserMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 073BE33E17D17E01002BD431 /* JSNavigatorUserMedia.cpp */; };
                073BE34117D17E01002BD431 /* JSNavigatorUserMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 073BE33F17D17E01002BD431 /* JSNavigatorUserMedia.h */; settings = {ATTRIBUTES = (Private, ); }; };
                073BE34817D17E7A002BD431 /* JSNavigatorUserMediaError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 073BE34217D17E7A002BD431 /* JSNavigatorUserMediaError.cpp */; };
                07C59B6817F784BA000FBCBB /* MediaSourceSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6517F784BA000FBCBB /* MediaSourceSettings.cpp */; };
                07C59B6917F784BA000FBCBB /* MediaSourceSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B6617F784BA000FBCBB /* MediaSourceSettings.h */; };
                07C59B6E17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */; };
-               07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B7417F7D09D000FBCBB /* CapabilityRange.h */; };
                07CA120E182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */; };
                07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07D07B141834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */; };
                070363DD181A1CDC00C074A5 /* AVMediaCaptureSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVMediaCaptureSource.mm; sourceTree = "<group>"; };
                070363DE181A1CDC00C074A5 /* AVVideoCaptureSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVVideoCaptureSource.h; sourceTree = "<group>"; };
                070363DF181A1CDC00C074A5 /* AVVideoCaptureSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVVideoCaptureSource.mm; sourceTree = "<group>"; };
-               070584FE17F9F05E005F2BCB /* CapabilityRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CapabilityRange.cpp; sourceTree = "<group>"; };
-               0705850017FA10D0005F2BCB /* JSAllVideoCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAllVideoCapabilities.cpp; sourceTree = "<group>"; };
-               0705850117FA10D0005F2BCB /* JSAllVideoCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAllVideoCapabilities.h; sourceTree = "<group>"; };
-               0705850517FA4689005F2BCB /* AllAudioCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllAudioCapabilities.h; sourceTree = "<group>"; };
-               0705850617FA4689005F2BCB /* AllAudioCapabilities.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AllAudioCapabilities.idl; sourceTree = "<group>"; };
-               0705850A17FA4827005F2BCB /* MediaStreamCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamCapabilities.h; sourceTree = "<group>"; };
-               0705850E17FA6FB1005F2BCB /* MediaStreamCapabilities.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaStreamCapabilities.idl; sourceTree = "<group>"; };
-               0705851017FA7107005F2BCB /* JSMediaStreamCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamCapabilities.cpp; sourceTree = "<group>"; };
-               0705851117FA7107005F2BCB /* JSMediaStreamCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaStreamCapabilities.h; sourceTree = "<group>"; };
-               0705851417FB0E2C005F2BCB /* MediaStreamCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamCapabilities.cpp; sourceTree = "<group>"; };
-               0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamCapabilitiesCustom.cpp; sourceTree = "<group>"; };
-               0705851817FB44B4005F2BCB /* JSAllAudioCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAllAudioCapabilities.cpp; sourceTree = "<group>"; };
-               0705851917FB44B4005F2BCB /* JSAllAudioCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAllAudioCapabilities.h; sourceTree = "<group>"; };
                0705851C17FDB23C005F2BCB /* MediaTrackConstraints.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaTrackConstraints.idl; sourceTree = "<group>"; };
                0705851D17FDC140005F2BCB /* MediaTrackConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackConstraint.h; sourceTree = "<group>"; };
                0705851E17FDC140005F2BCB /* MediaTrackConstraint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackConstraint.idl; sourceTree = "<group>"; };
                073794F819F5864E00E5A045 /* RTCNotifiersMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCNotifiersMock.h; sourceTree = "<group>"; };
                07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaDevicesRequest.cpp; sourceTree = "<group>"; };
                07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDevicesRequest.h; sourceTree = "<group>"; };
-               073AB4B017F8BACA006E0D6F /* AllVideoCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllVideoCapabilities.h; sourceTree = "<group>"; };
-               073AB4B517F92ECF006E0D6F /* JSCapabilityRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCapabilityRange.cpp; sourceTree = "<group>"; };
-               073AB4B617F92ECF006E0D6F /* JSCapabilityRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCapabilityRange.h; sourceTree = "<group>"; };
                073BE33E17D17E01002BD431 /* JSNavigatorUserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorUserMedia.cpp; sourceTree = "<group>"; };
                073BE33F17D17E01002BD431 /* JSNavigatorUserMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorUserMedia.h; sourceTree = "<group>"; };
                073BE34217D17E7A002BD431 /* JSNavigatorUserMediaError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorUserMediaError.cpp; sourceTree = "<group>"; };
                07C59B6517F784BA000FBCBB /* MediaSourceSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSourceSettings.cpp; sourceTree = "<group>"; };
                07C59B6617F784BA000FBCBB /* MediaSourceSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourceSettings.h; sourceTree = "<group>"; };
                07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamTrackCustom.cpp; sourceTree = "<group>"; };
-               07C59B7317F7D09D000FBCBB /* AllVideoCapabilities.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AllVideoCapabilities.idl; sourceTree = "<group>"; };
-               07C59B7417F7D09D000FBCBB /* CapabilityRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CapabilityRange.h; sourceTree = "<group>"; };
-               07C59B7517F7D09D000FBCBB /* CapabilityRange.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CapabilityRange.idl; sourceTree = "<group>"; };
                07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCPeerConnectionCustom.cpp; sourceTree = "<group>"; };
                07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
                07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCSessionDescriptionCustom.cpp; sourceTree = "<group>"; };
                07221B4617CEC32700848E51 /* mediastream */ = {
                        isa = PBXGroup;
                        children = (
-                               0705850517FA4689005F2BCB /* AllAudioCapabilities.h */,
-                               0705850617FA4689005F2BCB /* AllAudioCapabilities.idl */,
-                               073AB4B017F8BACA006E0D6F /* AllVideoCapabilities.h */,
-                               07C59B7317F7D09D000FBCBB /* AllVideoCapabilities.idl */,
-                               070584FE17F9F05E005F2BCB /* CapabilityRange.cpp */,
-                               07C59B7417F7D09D000FBCBB /* CapabilityRange.h */,
-                               07C59B7517F7D09D000FBCBB /* CapabilityRange.idl */,
                                2E3C8C611BFBA8DC00309566 /* CaptureDeviceManager.h */,
                                2E3C8C631BFBB75D00309566 /* CaptureDeviceManager.cpp */,
                                2E3C8C661BFBF8E100309566 /* CaptureDeviceInfo.h */,
                                07221B4C17CEC32700848E51 /* MediaStream.cpp */,
                                07221B4D17CEC32700848E51 /* MediaStream.h */,
                                07221B4E17CEC32700848E51 /* MediaStream.idl */,
-                               0705851417FB0E2C005F2BCB /* MediaStreamCapabilities.cpp */,
-                               0705850A17FA4827005F2BCB /* MediaStreamCapabilities.h */,
-                               0705850E17FA6FB1005F2BCB /* MediaStreamCapabilities.idl */,
                                07221B4F17CEC32700848E51 /* MediaStreamEvent.cpp */,
                                07221B5017CEC32700848E51 /* MediaStreamEvent.h */,
                                07221B5117CEC32700848E51 /* MediaStreamEvent.idl */,
                                07277E4117D018CC0015534D /* JSMediaStream.h */,
                                07277E4217D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp */,
                                07277E4317D018CC0015534D /* JSMediaStreamAudioDestinationNode.h */,
-                               0705851017FA7107005F2BCB /* JSMediaStreamCapabilities.cpp */,
-                               0705851117FA7107005F2BCB /* JSMediaStreamCapabilities.h */,
                                07277E4417D018CC0015534D /* JSMediaStreamEvent.cpp */,
                                07277E4517D018CC0015534D /* JSMediaStreamEvent.h */,
                                07277E4617D018CC0015534D /* JSMediaStreamTrack.cpp */,
                                AD726FE716D9F204003A4E6D /* JSMediaListCustom.h */,
                                077B640E1B8F5375003E9AD5 /* JSMediaSessionCustom.cpp */,
                                07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */,
-                               0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */,
                                E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */,
                                07C1C0E61BFB90A700BD2256 /* JSMediaTrackSupportedConstraintsCustom.cpp */,
                                410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
                CD61FE7B1794CA02004101EB /* MediaSource */ = {
                        isa = PBXGroup;
                        children = (
-                               0705851817FB44B4005F2BCB /* JSAllAudioCapabilities.cpp */,
-                               0705851917FB44B4005F2BCB /* JSAllAudioCapabilities.h */,
-                               0705850017FA10D0005F2BCB /* JSAllVideoCapabilities.cpp */,
-                               0705850117FA10D0005F2BCB /* JSAllVideoCapabilities.h */,
-                               073AB4B517F92ECF006E0D6F /* JSCapabilityRange.cpp */,
-                               073AB4B617F92ECF006E0D6F /* JSCapabilityRange.h */,
                                CD9DE17217AAC74C00EA386D /* JSMediaSource.cpp */,
                                CD9DE17317AAC74C00EA386D /* JSMediaSource.h */,
                                CD9DE17617AAC75B00EA386D /* JSSourceBuffer.cpp */,
                                E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */,
                                BCF7E491137CD7C7001DDAE7 /* AdjustViewSizeOrNot.h in Headers */,
                                84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */,
-                               0705850817FA4689005F2BCB /* AllAudioCapabilities.h in Headers */,
                                99CC0B4D18BE9849006CEBCC /* AllReplayInputs.h in Headers */,
-                               073AB4B317F8BACA006E0D6F /* AllVideoCapabilities.h in Headers */,
                                CEDA12D7152CA1CB00D9E08D /* AlternativeTextClient.h in Headers */,
                                CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */,
                                CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */,
                                49C7B9DD1042D32F0009D447 /* CanvasRenderingContext.h in Headers */,
                                49484FCB102CF23C00187DD3 /* CanvasRenderingContext2D.h in Headers */,
                                49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */,
-                               07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */,
                                079D0868162F20E800DB8658 /* CaptionUserPreferences.h in Headers */,
                                079D086B162F21F900DB8658 /* CaptionUserPreferencesMediaAF.h in Headers */,
                                99CC0B4F18BE9849006CEBCC /* CapturingInputCursor.h in Headers */,
                                44EFF6431A6FF92700D45EEC /* IOTypesSPI.h in Headers */,
                                07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */,
                                418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
-                               0705851B17FB44B4005F2BCB /* JSAllAudioCapabilities.h in Headers */,
-                               0705850317FA10D0005F2BCB /* JSAllVideoCapabilities.h in Headers */,
                                FDA15ECA12B03F50003A583A /* JSAnalyserNode.h in Headers */,
                                3198480C1A1E6CE800A13318 /* JSAnimationEvent.h in Headers */,
                                65DF31DB09D1C123000BE325 /* JSAttr.h in Headers */,
                                65DF323C09D1DE65001BE325 /* JSCanvasProxy.h in Headers */,
                                49EED1431051969400099FAB /* JSCanvasRenderingContext.h in Headers */,
                                49EED1451051969400099FAB /* JSCanvasRenderingContext2D.h in Headers */,
-                               073AB4B817F92ECF006E0D6F /* JSCapabilityRange.h in Headers */,
                                93F9B7A10BA6032600854064 /* JSCDATASection.h in Headers */,
                                FDA15EA212B03EE1003A583A /* JSChannelMergerNode.h in Headers */,
                                FDA15EA412B03EE1003A583A /* JSChannelSplitterNode.h in Headers */,
                                07277E4D17D018CC0015534D /* JSMediaStream.h in Headers */,
                                07277E4F17D018CC0015534D /* JSMediaStreamAudioDestinationNode.h in Headers */,
                                FDBD480D159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h in Headers */,
-                               0705851317FA7107005F2BCB /* JSMediaStreamCapabilities.h in Headers */,
                                07277E5117D018CC0015534D /* JSMediaStreamEvent.h in Headers */,
                                07277E5317D018CC0015534D /* JSMediaStreamTrack.h in Headers */,
                                07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */,
                                078E094C17D1709600420AA1 /* MediaStreamAudioDestinationNode.h in Headers */,
                                0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
                                FD671A78159BB07000197559 /* MediaStreamAudioSourceNode.h in Headers */,
-                               0705850B17FA4827005F2BCB /* MediaStreamCapabilities.h in Headers */,
                                070F549817F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h in Headers */,
                                078E093917D16B2C00420AA1 /* MediaStreamCreationClient.h in Headers */,
                                078E091617D14D1C00420AA1 /* MediaStreamEvent.h in Headers */,
                                49C7B9DC1042D32F0009D447 /* CanvasRenderingContext.cpp in Sources */,
                                49484FCA102CF23C00187DD3 /* CanvasRenderingContext2D.cpp in Sources */,
                                49484FCD102CF23C00187DD3 /* CanvasStyle.cpp in Sources */,
-                               070584FF17F9F05E005F2BCB /* CapabilityRange.cpp in Sources */,
                                072CA86116CB4DC3008AE131 /* CaptionUserPreferences.cpp in Sources */,
                                079D086C162F21F900DB8658 /* CaptionUserPreferencesMediaAF.cpp in Sources */,
                                99CC0B4E18BE9849006CEBCC /* CapturingInputCursor.cpp in Sources */,
                                AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */,
                                07AC47011952102100EE9723 /* ISOVTTCue.cpp in Sources */,
                                418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */,
-                               0705851A17FB44B4005F2BCB /* JSAllAudioCapabilities.cpp in Sources */,
-                               0705850217FA10D0005F2BCB /* JSAllVideoCapabilities.cpp in Sources */,
                                FDA15EC912B03F50003A583A /* JSAnalyserNode.cpp in Sources */,
                                31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */,
                                3198480B1A1E6CE400A13318 /* JSAnimationEvent.cpp in Sources */,
                                49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,
                                49EED14E1051971A00099FAB /* JSCanvasRenderingContext2DCustom.cpp in Sources */,
                                49EED1501051971A00099FAB /* JSCanvasRenderingContextCustom.cpp in Sources */,
-                               073AB4B717F92ECF006E0D6F /* JSCapabilityRange.cpp in Sources */,
                                93F9B7A00BA6032600854064 /* JSCDATASection.cpp in Sources */,
                                FDA15EA112B03EE1003A583A /* JSChannelMergerNode.cpp in Sources */,
                                FDA15EA312B03EE1003A583A /* JSChannelSplitterNode.cpp in Sources */,
                                07277E4C17D018CC0015534D /* JSMediaStream.cpp in Sources */,
                                07277E4E17D018CC0015534D /* JSMediaStreamAudioDestinationNode.cpp in Sources */,
                                FDBD480C159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp in Sources */,
-                               0705851217FA7107005F2BCB /* JSMediaStreamCapabilities.cpp in Sources */,
-                               0705851717FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp in Sources */,
                                07277E5017D018CC0015534D /* JSMediaStreamEvent.cpp in Sources */,
                                07277E5217D018CC0015534D /* JSMediaStreamTrack.cpp in Sources */,
                                07277E5417D018CC0015534D /* JSMediaStreamTrackEvent.cpp in Sources */,
                                078E094B17D1709600420AA1 /* MediaStreamAudioDestinationNode.cpp in Sources */,
                                0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */,
                                FD671A77159BB07000197559 /* MediaStreamAudioSourceNode.cpp in Sources */,
-                               0705851517FB0EEA005F2BCB /* MediaStreamCapabilities.cpp in Sources */,
                                078E090017D14CEE00420AA1 /* MediaStreamEvent.cpp in Sources */,
                                0711589117DF6F6600EDFE2B /* MediaStreamPrivate.cpp in Sources */,
                                078E090117D14CEE00420AA1 /* MediaStreamRegistry.cpp in Sources */,
index 72136f3..55154b8 100644 (file)
@@ -31,6 +31,7 @@
 #include "ExceptionCode.h"
 #include "JSDOMBinding.h"
 #include "MediaSourceSettings.h"
+#include "MediaStreamTrack.h"
 #include <runtime/JSObject.h>
 #include <runtime/ObjectConstructor.h>
 
@@ -75,6 +76,86 @@ JSC::JSValue JSMediaStreamTrack::getSettings(ExecState& state)
     return object;
 }
 
+static JSValue capabilityValue(const CapabilityValueOrRange& value, ExecState& state)
+{
+    if (value.type() == CapabilityValueOrRange::DoubleRange || value.type() == CapabilityValueOrRange::ULongRange) {
+        JSObject* object = constructEmptyObject(&state);
+
+        CapabilityValueOrRange::ValueUnion min = value.rangeMin();
+        CapabilityValueOrRange::ValueUnion max = value.rangeMax();
+        if (value.type() == CapabilityValueOrRange::DoubleRange) {
+            object->putDirect(state.vm(), Identifier::fromString(&state, "min"), jsNumber(min.asDouble));
+            object->putDirect(state.vm(), Identifier::fromString(&state, "max"), jsNumber(max.asDouble));
+        } else {
+            object->putDirect(state.vm(), Identifier::fromString(&state, "min"), jsNumber(min.asULong));
+            object->putDirect(state.vm(), Identifier::fromString(&state, "max"), jsNumber(max.asULong));
+        }
+
+        return object;
+    }
+
+    if (value.type() == CapabilityValueOrRange::Double)
+        return jsNumber(value.value().asDouble);
+
+    return jsNumber(value.value().asULong);
+}
+
+JSC::JSValue JSMediaStreamTrack::getCapabilities(ExecState& state)
+{
+    JSValue thisValue = state.thisValue();
+    JSMediaStreamTrack* castedThis = jsDynamicCast<JSMediaStreamTrack*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return JSValue::decode(throwThisTypeError(state, "MediaStreamTrack", "getSettings"));
+
+    JSObject* object = constructEmptyObject(&state);
+    auto& impl = castedThis->wrapped();
+    RefPtr<RealtimeMediaSourceCapabilities> capabilities = WTF::getPtr(impl.getCapabilities());
+
+    if (capabilities->supportsWidth())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "width"), capabilityValue(capabilities->width(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsHeight())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "height"), capabilityValue(capabilities->height(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsAspectRatio())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "aspectRatio"), capabilityValue(capabilities->aspectRatio(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsFrameRate())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "frameRate"), capabilityValue(capabilities->frameRate(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsFacingMode()) {
+        const Vector<RealtimeMediaSourceSettings::VideoFacingMode>& modes = capabilities->facingMode();
+        Vector<String> facingModes;
+        if (modes.size()) {
+
+            facingModes.reserveCapacity(modes.size());
+
+            for (auto& mode : modes)
+                facingModes.append(RealtimeMediaSourceSettings::facingMode(mode));
+        }
+
+        object->putDirect(state.vm(), Identifier::fromString(&state, "facingMode"), jsArray(&state, castedThis->globalObject(), facingModes), DontDelete | ReadOnly);
+    }
+    if (capabilities->supportsVolume())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "volume"), capabilityValue(capabilities->volume(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsSampleRate())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "sampleRate"), capabilityValue(capabilities->sampleRate(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsSampleSize())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "sampleSize"), capabilityValue(capabilities->sampleSize(), state), DontDelete | ReadOnly);
+    if (capabilities->supportsEchoCancellation()) {
+        Vector<String> cancellation;
+        cancellation.reserveCapacity(2);
+
+        cancellation.append("true");
+        cancellation.append(capabilities->echoCancellation() == RealtimeMediaSourceCapabilities::EchoCancellation::ReadWrite ? "true" : "false");
+
+        object->putDirect(state.vm(), Identifier::fromString(&state, "echoCancellation"), jsArray(&state, castedThis->globalObject(), cancellation), DontDelete | ReadOnly);
+    }
+    if (capabilities->supportsDeviceId())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "deviceId"), jsStringWithCache(&state, capabilities->deviceId()), DontDelete | ReadOnly);
+    if (capabilities->supportsGroupId())
+        object->putDirect(state.vm(), Identifier::fromString(&state, "groupId"), jsStringWithCache(&state, capabilities->groupId()), DontDelete | ReadOnly);
+    
+
+    return object;
+}
+
 } // namespace WebCore
 
 #endif
index 3a03e06..ac1785d 100644 (file)
 
 namespace WebCore {
 
-class RealtimeMediaSourceCapabilityRange {
+class CapabilityValueOrRange {
 public:
-    
-    RealtimeMediaSourceCapabilityRange(float min, float max, bool supported = true)
-        : m_type(Float)
+
+    enum Type {
+        Undefined,
+        Double,
+        ULong,
+        DoubleRange,
+        ULongRange,
+    };
+    Type type() const { return m_type; }
+
+    union ValueUnion {
+        unsigned long asULong;
+        double asDouble;
+    };
+
+    CapabilityValueOrRange()
+        : m_type(Undefined)
     {
-        m_min.asFloat = min;
-        m_max.asFloat = max;
-        m_supported = supported;
     }
-    
-    RealtimeMediaSourceCapabilityRange(unsigned long min, unsigned long max, bool supported = true)
+
+    CapabilityValueOrRange(double value)
+        : m_type(Double)
+    {
+        m_minOrValue.asDouble = value;
+    }
+
+    CapabilityValueOrRange(unsigned long value)
         : m_type(ULong)
     {
-        m_min.asULong = min;
-        m_max.asULong = max;
-        m_supported = supported;
+        m_minOrValue.asULong = value;
     }
-    
-    RealtimeMediaSourceCapabilityRange()
+
+    CapabilityValueOrRange(double min, double max)
+        : m_type(DoubleRange)
     {
-        m_type = Undefined;
-        m_min.asULong = 0;
-        m_max.asULong = 0;
-        m_supported = false;
+        m_minOrValue.asDouble = min;
+        m_max.asDouble = max;
     }
     
-    enum Type { Undefined, Float, ULong };
-    
-    union ValueUnion {
-        unsigned long asULong;
-        float asFloat;
-    };
-    
-    const ValueUnion& min() const { return m_min; }
-    const ValueUnion& max() const { return m_max; }
-    Type type() const { return m_type; }
-    bool supported() const { return m_supported; }
-    
+    CapabilityValueOrRange(unsigned long min, unsigned long max)
+        : m_type(ULongRange)
+    {
+        m_minOrValue.asULong = min;
+        m_max.asULong = max;
+    }
+
+    const ValueUnion& rangeMin() const
+    {
+        ASSERT(m_type == DoubleRange || m_type == ULongRange);
+        return m_minOrValue;
+    }
+
+    const ValueUnion& rangeMax() const
+    {
+        ASSERT(m_type == DoubleRange || m_type == ULongRange);
+        return m_max;
+    }
+
+    const ValueUnion& value() const
+    {
+        ASSERT(m_type == Double || m_type == ULong);
+        return m_minOrValue;
+    }
+
 private:
-    ValueUnion m_min;
+    ValueUnion m_minOrValue;
     ValueUnion m_max;
     Type m_type;
-    bool m_supported;
 };
 
 class RealtimeMediaSourceCapabilities : public RefCounted<RealtimeMediaSourceCapabilities> {
 public:
-    static PassRefPtr<RealtimeMediaSourceCapabilities> create()
+    static PassRefPtr<RealtimeMediaSourceCapabilities> create(const RealtimeMediaSourceSupportedConstraints& supportedConstraints)
     {
-        return adoptRef(new RealtimeMediaSourceCapabilities());
+        return adoptRef(new RealtimeMediaSourceCapabilities(supportedConstraints));
     }
 
     ~RealtimeMediaSourceCapabilities() { }
 
-    const Vector<AtomicString>& sourceId() { return m_sourceId; }
-    void setSourceId(const AtomicString& id)  { m_sourceId.reserveCapacity(1); m_sourceId.insert(0, id); }
+    bool supportsWidth() const { return m_supportedConstraints.supportsWidth(); }
+    const CapabilityValueOrRange& width() { return m_width; }
+    void setWidth(const CapabilityValueOrRange& width) { m_width = width; }
+
+    bool supportsHeight() const { return m_supportedConstraints.supportsHeight(); }
+    const CapabilityValueOrRange& height() { return m_height; }
+    void setHeight(const CapabilityValueOrRange& height) { m_height = height; }
 
-    const Vector<RealtimeMediaSourceSettings::VideoFacingMode>& facingModes() { return m_facingMode; }
+    bool supportsFrameRate() const { return m_supportedConstraints.supportsFrameRate(); }
+    const CapabilityValueOrRange& frameRate() { return m_frameRate; }
+    void setFrameRate(const CapabilityValueOrRange& frameRate) { m_frameRate = frameRate; }
+
+    bool supportsFacingMode() const { return m_supportedConstraints.supportsFacingMode(); }
+    const Vector<RealtimeMediaSourceSettings::VideoFacingMode>& facingMode() { return m_facingMode; }
     void addFacingMode(RealtimeMediaSourceSettings::VideoFacingMode mode) { m_facingMode.append(mode); }
 
-    const RealtimeMediaSourceCapabilityRange& width() { return m_width; }
-    void setWidthRange(const RealtimeMediaSourceCapabilityRange& width) { m_width = width; }
+    bool supportsAspectRatio() const { return m_supportedConstraints.supportsAspectRatio(); }
+    const CapabilityValueOrRange& aspectRatio() { return m_aspectRatio; }
+    void setAspectRatio(const CapabilityValueOrRange& aspectRatio) { m_aspectRatio = aspectRatio; }
 
-    const RealtimeMediaSourceCapabilityRange& height() { return m_height; }
-    void setHeightRange(const RealtimeMediaSourceCapabilityRange& height) { m_height = height; }
+    bool supportsVolume() const { return m_supportedConstraints.supportsVolume(); }
+    const CapabilityValueOrRange& volume() { return m_volume; }
+    void setVolume(const CapabilityValueOrRange& volume) { m_volume = volume; }
 
-    const RealtimeMediaSourceCapabilityRange& frameRate() { return m_frameRate; }
-    void setFrameRateRange(const RealtimeMediaSourceCapabilityRange& frameRate) { m_frameRate = frameRate; }
+    bool supportsSampleRate() const { return m_supportedConstraints.supportsSampleRate(); }
+    const CapabilityValueOrRange& sampleRate() { return m_sampleRate; }
+    void setSampleRate(const CapabilityValueOrRange& sampleRate) { m_sampleRate = sampleRate; }
 
-    const RealtimeMediaSourceCapabilityRange& aspectRatio() { return m_aspectRatio; }
-    void setAspectRatioRange(const RealtimeMediaSourceCapabilityRange& aspectRatio) { m_aspectRatio = aspectRatio; }
+    bool supportsSampleSize() const { return m_supportedConstraints.supportsSampleSize(); }
+    const CapabilityValueOrRange& sampleSize() { return m_sampleSize; }
+    void setSampleSize(const CapabilityValueOrRange& sampleSize) { m_sampleSize = sampleSize; }
 
-    const RealtimeMediaSourceCapabilityRange& volume() { return m_volume; }
-    void setVolumeRange(const RealtimeMediaSourceCapabilityRange& volume) { m_volume = volume; }
+    enum class EchoCancellation {
+        ReadOnly = 0,
+        ReadWrite = 1,
+    };
+    bool supportsEchoCancellation() const { return m_supportedConstraints.supportsEchoCancellation(); }
+    EchoCancellation echoCancellation() { return m_echoCancellation; }
+    void setEchoCancellation(EchoCancellation echoCancellation) { m_echoCancellation = echoCancellation; }
 
-    bool hasVideoSource() { return m_videoSource; }
-    void setHasVideoSource(bool isVideo) { m_videoSource = isVideo; }
+    bool supportsDeviceId() const { return m_supportedConstraints.supportsDeviceId(); }
+    const AtomicString& deviceId() { return m_deviceId; }
+    void setDeviceId(const AtomicString& id)  { m_deviceId = id; }
 
+    bool supportsGroupId() const { return m_supportedConstraints.supportsGroupId(); }
+    const AtomicString& groupId() { return m_groupId; }
+    void setGroupId(const AtomicString& id)  { m_groupId = id; }
+    
 private:
-    RealtimeMediaSourceCapabilities()
-        : m_videoSource(false)
+    RealtimeMediaSourceCapabilities(const RealtimeMediaSourceSupportedConstraints& supportedConstraints)
+        : m_supportedConstraints(supportedConstraints)
     {
     }
 
-    Vector<AtomicString> m_sourceId;
+    CapabilityValueOrRange m_width;
+    CapabilityValueOrRange m_height;
+    CapabilityValueOrRange m_aspectRatio;
+    CapabilityValueOrRange m_frameRate;
     Vector<RealtimeMediaSourceSettings::VideoFacingMode> m_facingMode;
-
-    RealtimeMediaSourceCapabilityRange m_width;
-    RealtimeMediaSourceCapabilityRange m_height;
-    RealtimeMediaSourceCapabilityRange m_frameRate;
-    RealtimeMediaSourceCapabilityRange m_aspectRatio;
-    RealtimeMediaSourceCapabilityRange m_volume;
-
-    bool m_videoSource;
+    CapabilityValueOrRange m_volume;
+    CapabilityValueOrRange m_sampleRate;
+    CapabilityValueOrRange m_sampleSize;
+    EchoCancellation m_echoCancellation;
+    AtomicString m_deviceId;
+    AtomicString m_groupId;
+
+    const RealtimeMediaSourceSupportedConstraints& m_supportedConstraints;
 };
 
 } // namespace WebCore
index fba48bf..7e74925 100644 (file)
@@ -67,8 +67,8 @@ public:
     void setFacingMode(VideoFacingMode facingMode) { m_facingMode = facingMode; }
 
     bool supportsVolume() const { return m_supportedConstraints.supportsVolume(); }
-    unsigned long volume() const { return m_volume; }
-    void setVolume(unsigned long volume) { m_volume = volume; }
+    double volume() const { return m_volume; }
+    void setVolume(double volume) { m_volume = volume; }
 
     bool supportsSampleRate() const { return m_supportedConstraints.supportsSampleRate(); }
     unsigned long sampleRate() const { return m_sampleRate; }
@@ -98,7 +98,7 @@ private:
     float m_aspectRatio { 0 };
     float m_frameRate { 0 };
     VideoFacingMode m_facingMode { Unknown };
-    unsigned long m_volume { 0 };
+    double m_volume { 0 };
     unsigned long m_sampleRate { 0 };
     unsigned long m_sampleSize { 0 };
     bool m_echoCancellation { 0 };
index 4a0497d..bfca531 100644 (file)
@@ -77,9 +77,10 @@ AVAudioCaptureSource::~AVAudioCaptureSource()
 {
 }
 
-void AVAudioCaptureSource::initializeCapabilities(RealtimeMediaSourceCapabilities&)
+void AVAudioCaptureSource::initializeCapabilities(RealtimeMediaSourceCapabilities& capabilities)
 {
     // FIXME: finish this implementation - https://webkit.org/b/122430
+    capabilities.setVolume(CapabilityValueOrRange(0, 1.0));
 }
 
 void AVAudioCaptureSource::initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints)
index 77a31e9..469c250 100644 (file)
@@ -28,7 +28,9 @@
 
 #if ENABLE(MEDIA_STREAM) && USE(AVFOUNDATION)
 
+#import "AVCaptureDeviceManager.h"
 #import "AudioSourceProvider.h"
+#import "CoreMediaSoftLink.h"
 #import "Logging.h"
 #import "MediaConstraints.h"
 #import "RealtimeMediaSourceSettings.h"
@@ -39,8 +41,6 @@
 #import <wtf/MainThread.h>
 #import <wtf/NeverDestroyed.h>
 
-#import "CoreMediaSoftLink.h"
-
 typedef AVCaptureConnection AVCaptureConnectionType;
 typedef AVCaptureDevice AVCaptureDeviceType;
 typedef AVCaptureDeviceInput AVCaptureDeviceInputType;
@@ -188,8 +188,9 @@ RealtimeMediaSourceSupportedConstraints& AVMediaCaptureSource::supportedConstrai
 RefPtr<RealtimeMediaSourceCapabilities> AVMediaCaptureSource::capabilities()
 {
     if (!m_capabilities) {
-        m_capabilities = RealtimeMediaSourceCapabilities::create();
-        m_capabilities->setSourceId(id());
+        m_capabilities = RealtimeMediaSourceCapabilities::create(AVCaptureDeviceManager::singleton().supportedConstraints());
+        m_capabilities->setDeviceId(id());
+
         initializeCapabilities(*m_capabilities.get());
     }
     return m_capabilities;
index e4ea445..1126720 100644 (file)
@@ -108,10 +108,9 @@ AVVideoCaptureSource::~AVVideoCaptureSource()
 {
 }
 
-void AVVideoCaptureSource::initializeCapabilities(RealtimeMediaSourceCapabilities& capabilities)
+void AVVideoCaptureSource::initializeCapabilities(RealtimeMediaSourceCapabilities&)
 {
     // FIXME: finish this implementation
-    capabilities.setSourceId(id());
 }
 
 void AVVideoCaptureSource::initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints)
index a45cb90..7b8d61c 100644 (file)
 #import "CARingBuffer.h"
 #import "Logging.h"
 #import "MediaTimeAVFoundation.h"
-#import <AVFoundation/AVAssetTrack.h>
-#import <AVFoundation/AVAudioMix.h>
-#import <AVFoundation/AVMediaFormat.h>
-#import <AVFoundation/AVPlayerItem.h>
+#import <AudioToolbox/AudioToolbox.h>
 #import <objc/runtime.h>
 #import <wtf/MainThread.h>
 
 
 #import "CoreMediaSoftLink.h"
 
-SOFT_LINK_FRAMEWORK(AVFoundation)
 SOFT_LINK_FRAMEWORK(AudioToolbox)
 
-SOFT_LINK_CLASS(AVFoundation, AVPlayerItem)
-SOFT_LINK_CLASS(AVFoundation, AVMutableAudioMix)
-SOFT_LINK_CLASS(AVFoundation, AVMutableAudioMixInputParameters)
-
 SOFT_LINK(AudioToolbox, AudioConverterConvertComplexBuffer, OSStatus, (AudioConverterRef inAudioConverter, UInt32 inNumberPCMFrames, const AudioBufferList* inInputData, AudioBufferList* outOutputData), (inAudioConverter, inNumberPCMFrames, inInputData, outOutputData))
 SOFT_LINK(AudioToolbox, AudioConverterNew, OSStatus, (const AudioStreamBasicDescription* inSourceFormat, const AudioStreamBasicDescription* inDestinationFormat, AudioConverterRef* outAudioConverter), (inSourceFormat, inDestinationFormat, outAudioConverter))
 
index a62f9c6..9dfd651 100644 (file)
@@ -57,12 +57,14 @@ void MockRealtimeAudioSource::updateSettings(RealtimeMediaSourceSettings& settin
 
 void MockRealtimeAudioSource::initializeCapabilities(RealtimeMediaSourceCapabilities& capabilities)
 {
-    capabilities.setVolumeRange(RealtimeMediaSourceCapabilityRange(0UL, 100UL, true));
+    capabilities.setVolume(CapabilityValueOrRange(0, 1.0));
+    capabilities.setEchoCancellation(RealtimeMediaSourceCapabilities::EchoCancellation::ReadWrite);
 }
 
 void MockRealtimeAudioSource::initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints)
 {
     supportedConstraints.setSupportsVolume(true);
+    supportedConstraints.setSupportsEchoCancellation(true);
 }
 
 } // namespace WebCore
index aae1ee8..8ab3e7c 100644 (file)
@@ -95,8 +95,8 @@ RefPtr<RealtimeMediaSourceCapabilities> MockRealtimeMediaSource::capabilities()
     if (m_capabilities)
         return m_capabilities;
 
-    m_capabilities = RealtimeMediaSourceCapabilities::create();
-    m_capabilities->setSourceId(id());
+    m_capabilities = RealtimeMediaSourceCapabilities::create(supportedConstraints());
+    m_capabilities->setDeviceId(id());
     initializeCapabilities(*m_capabilities.get());
 
     return m_capabilities;
index 2f13cbc..618a8dd 100644 (file)
@@ -103,10 +103,10 @@ void MockRealtimeVideoSource::initializeCapabilities(RealtimeMediaSourceCapabili
 {
     capabilities.addFacingMode(RealtimeMediaSourceSettings::User);
     capabilities.addFacingMode(RealtimeMediaSourceSettings::Environment);
-    capabilities.setWidthRange(RealtimeMediaSourceCapabilityRange(320UL, 1920UL, true));
-    capabilities.setHeightRange(RealtimeMediaSourceCapabilityRange(240UL, 1080UL, true));
-    capabilities.setFrameRateRange(RealtimeMediaSourceCapabilityRange(15.0f, 60.0f, true));
-    capabilities.setAspectRatioRange(RealtimeMediaSourceCapabilityRange(4 / 3.0f, 16 / 9.0f, true));
+    capabilities.setWidth(CapabilityValueOrRange(320UL, 1920UL));
+    capabilities.setHeight(CapabilityValueOrRange(240UL, 1080UL));
+    capabilities.setFrameRate(CapabilityValueOrRange(15.0, 60.0));
+    capabilities.setAspectRatio(CapabilityValueOrRange(4 / 3.0, 16 / 9.0));
 }
 
 void MockRealtimeVideoSource::initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints)