[MediaStream API] update MediaStreamTrack object to match spec
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Oct 2013 23:48:19 +0000 (23:48 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Oct 2013 23:48:19 +0000 (23:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121940

Reviewed by Jer Noble.

Source/WebCore:

No new tests, existing test updated.

Add new source files to the project:
* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:

New capability dictionary objects:
* Modules/mediastream/AllAudioCapabilities.h: Added.
* Modules/mediastream/AllAudioCapabilities.idl: Added.
* Modules/mediastream/AllVideoCapabilities.h: Added.
* Modules/mediastream/AllVideoCapabilities.idl: Added.

* Modules/mediastream/AudioStreamTrack.cpp:
(WebCore::AudioStreamTrack::create): New version that takes a MediaStreamTrack*.
* Modules/mediastream/AudioStreamTrack.h:

New object for a capability range:
* Modules/mediastream/CapabilityRange.cpp: Added.
* Modules/mediastream/CapabilityRange.h: Added.
* Modules/mediastream/CapabilityRange.idl: Added.

* Modules/mediastream/MediaConstraintsImpl.h: Make initialize() public.

New object for the current states for a media source.
* Modules/mediastream/MediaSourceStates.cpp: Added.
* Modules/mediastream/MediaSourceStates.h: Added.
* Modules/mediastream/MediaSourceStates.idl: Added.

Don't call the media stream center to notify it when the state of other
objects change.
* Modules/mediastream/MediaStream.cpp:
(WebCore::processTrack): Remove the stream source duplication hack.
(WebCore::createFromSourceVectors):
(WebCore::MediaStream::MediaStream):
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
* Modules/mediastream/MediaStream.h:

New object for the capabilities of a source.
* Modules/mediastream/MediaStreamCapabilities.cpp: Added.
* Modules/mediastream/MediaStreamCapabilities.h: Added.
* Modules/mediastream/MediaStreamCapabilities.idl: Added.

Update interface to match spec.
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack): Define a copy constructor to use in clone().
(WebCore::MediaStreamTrack::setSource): Call removeObserver if the track already has a source.
    Initialize m_muted from new source's muted state.
(WebCore::MediaStreamTrack::id): Allow source to provide ID as the spec suggests.
(WebCore::MediaStreamTrack::setEnabled): Add some spec text to clarify logic. Always call
    source->setEnabled, it can figure out if nothing needs to be done.
(WebCore::MediaStreamTrack::muted): Don't call the stream center when muted changes, the
    source can take care of notifying interested parties.
(WebCore::MediaStreamTrack::readonly): New.
(WebCore::MediaStreamTrack::remote): New.
(WebCore::MediaStreamTrack::constraints): New.
(WebCore::MediaStreamTrack::states): New.
(WebCore::MediaStreamTrack::capabilities): New.
(WebCore::MediaStreamTrack::applyConstraints): New.
(WebCore::MediaStreamTrack::clone): New.
(WebCore::MediaStreamTrack::stopProducingData): New.
(WebCore::MediaStreamTrack::sourceStateChanged): Renamed from sourceChangedState.
(WebCore::MediaStreamTrack::sourceMutedChanged): New.
(WebCore::MediaStreamTrack::sourceEnabledChanged): New.
(WebCore::MediaStreamTrack::configureTrackRendering): New.
(WebCore::MediaStreamTrack::stopped): New.
(WebCore::MediaStreamTrack::stop): Call stopProducingData.
(WebCore::MediaStreamTrack::scheduleEventDispatch): New.
(WebCore::MediaStreamTrack::dispatchQueuedEvents): New.
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:

* Modules/mediastream/MediaTrackConstraint.cpp: Added.
* Modules/mediastream/MediaTrackConstraint.h: Added.
* Modules/mediastream/MediaTrackConstraint.idl: Added.

// Add empty classes/IDL for track constraint objects.
* Modules/mediastream/MediaTrackConstraintSet.cpp: Added.
* Modules/mediastream/MediaTrackConstraintSet.h: Added.
* Modules/mediastream/MediaTrackConstraintSet.idl: Added.
* Modules/mediastream/MediaTrackConstraints.cpp: Added.
* Modules/mediastream/MediaTrackConstraints.h: Added.
* Modules/mediastream/MediaTrackConstraints.idl: Added.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::callSuccessHandler): Don't call the stream center, the
    stream can take care of notifying interested parties.

// Add a constructor and create() that take a MediaStreamTrack*.
* Modules/mediastream/VideoStreamTrack.cpp:
(WebCore::VideoStreamTrack::create):
(WebCore::VideoStreamTrack::VideoStreamTrack):
* Modules/mediastream/VideoStreamTrack.h:

// Create a MediaStreamSource subclass for WebAudio
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createMediaStreamSource): Call isAudioStreamSource instead
    of checking deviceID.
* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): Create a
    MediaStreamAudioSource instead of a MediaStreamSource.
* Modules/webaudio/MediaStreamAudioDestinationNode.h:
* Modules/webaudio/MediaStreamAudioSource.cpp: Added.
* Modules/webaudio/MediaStreamAudioSource.h: Added.
(WebCore::MediaStreamAudioSource::~MediaStreamAudioSource):

// Add new generated files.
* bindings/js/JSMediaSourceStatesCustom.cpp: Added.
* bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Added.

* dom/EventNames.h: Defined 'overconstrained' event.

* platform/mediastream/MediaStreamCenter.h: Get rid of all of the methods nobody uses.
    It isn't clear that they are necessary, and we can add them back if/when we need them.

* platform/mediastream/MediaStreamDescriptor.cpp:
(WebCore::MediaStreamDescriptor::~MediaStreamDescriptor): Clear the all source streams.
(WebCore::MediaStreamDescriptor::removeSource): Clear the source stream.
* platform/mediastream/MediaStreamDescriptor.h:

// Make MediaStreamSource an abstract base class, and remove everyting WebAudio-specific
//  to MediaStreamAudioSource.
* platform/mediastream/MediaStreamSource.cpp:
(WebCore::MediaStreamSource::MediaStreamSource): Remove readyState and requiresConsumer
    parameters. Create new UUID for id if non was passed.
(WebCore::MediaStreamSource::reset): Reset internal state to just-constructed. Used for testing.
(WebCore::MediaStreamSource::setReadyState): sourceChangedState -> sourceStateChanged.
(WebCore::MediaStreamSource::setStream): Remove the ASSERT that check for a source being
    added to a new stream. This is still a problem, but it is required for testing and will
    be fixed as a part of bug 121954.
(WebCore::MediaStreamSource::setConstraints): Added.
(WebCore::MediaStreamSource::setMuted): Notify observers when muted changes.
(WebCore::MediaStreamSource::setEnabled): Notify observers when enabled changes.
(WebCore::MediaStreamSource::readonly): New.
(WebCore::MediaStreamSource::stop): New. Set state to Ended when all of the observers has
    stopped.
* platform/mediastream/MediaStreamSource.h:

// Define platform versions of the Capabilities classes.
* platform/mediastream/MediaStreamSourceCapabilities.h: Added.

// Update the non-functional platform stream centers for the API changes.
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp:
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.h:
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp:
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h:
* platform/mediastream/mac/MediaStreamCenterMac.cpp:
* platform/mediastream/mac/MediaStreamCenterMac.h:

// Update the Mock stream center for the API changes. Add a concrete mock MediaStreamSource
//  subclass.
* platform/mock/MockMediaStreamCenter.cpp:
(WebCore::MockSource::MockSource): New, the mock media stream source.
(WebCore::MockSource::~MockSource):
(WebCore::MockSource::capabilities):
(WebCore::MockSource::states):
(WebCore::mockSourceMap):
(WebCore::mockAudioSourceID):
(WebCore::mockVideoSourceID):
(WebCore::initializeMockSources): Create one audio and one video mock source.
(WebCore::MockMediaStreamCenter::registerMockMediaStreamCenter): Call initializeMockSources.
(WebCore::MockMediaStreamCenter::createMediaStream): Use the already allocated mock media
    sources.
(WebCore::MockMediaStreamCenter::getMediaStreamTrackSources): Ditto.
* platform/mock/MockMediaStreamCenter.h:

LayoutTests:

* fast/mediastream/MediaStreamTrack-expected.txt:
* fast/mediastream/MediaStreamTrack.html:
* fast/mediastream/MediaStreamTrack-getSources-expected.txt:
* fast/mediastream/MediaStreamTrack-getSources.html:

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

65 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaStreamTrack-expected.txt
LayoutTests/fast/mediastream/MediaStreamTrack-getSources-expected.txt
LayoutTests/fast/mediastream/MediaStreamTrack.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/mediastream/AllAudioCapabilities.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/AllAudioCapabilities.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/AllVideoCapabilities.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/AllVideoCapabilities.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/AudioStreamTrack.cpp
Source/WebCore/Modules/mediastream/AudioStreamTrack.h
Source/WebCore/Modules/mediastream/CapabilityRange.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/CapabilityRange.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/CapabilityRange.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h
Source/WebCore/Modules/mediastream/MediaSourceStates.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaSourceStates.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaSourceStates.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/MediaStreamTrack.idl
Source/WebCore/Modules/mediastream/MediaTrackConstraint.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraint.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraint.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraints.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/mediastream/VideoStreamTrack.cpp
Source/WebCore/Modules/mediastream/VideoStreamTrack.h
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp
Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h
Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp [new file with mode: 0644]
Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSMediaSourceStatesCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp [new file with mode: 0644]
Source/WebCore/dom/EventNames.h
Source/WebCore/platform/mediastream/MediaStreamCenter.cpp
Source/WebCore/platform/mediastream/MediaStreamCenter.h
Source/WebCore/platform/mediastream/MediaStreamDescriptor.cpp
Source/WebCore/platform/mediastream/MediaStreamDescriptor.h
Source/WebCore/platform/mediastream/MediaStreamSource.cpp
Source/WebCore/platform/mediastream/MediaStreamSource.h
Source/WebCore/platform/mediastream/MediaStreamSourceCapabilities.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp
Source/WebCore/platform/mediastream/blackberry/MediaStreamCenterBlackBerry.h
Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h
Source/WebCore/platform/mediastream/mac/MediaStreamCenterMac.cpp
Source/WebCore/platform/mediastream/mac/MediaStreamCenterMac.h
Source/WebCore/platform/mock/MockMediaStreamCenter.cpp
Source/WebCore/platform/mock/MockMediaStreamCenter.h

index f8ed819..4bfc9e4 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-07  Eric Carlson  <eric.carlson@apple.com>
+
+        [MediaStream API] update MediaStreamTrack object to match spec
+        https://bugs.webkit.org/show_bug.cgi?id=121940
+
+        Reviewed by Jer Noble.
+
+        * fast/mediastream/MediaStreamTrack-expected.txt:
+        * fast/mediastream/MediaStreamTrack.html:
+        * fast/mediastream/MediaStreamTrack-getSources-expected.txt:
+        * fast/mediastream/MediaStreamTrack-getSources.html:
+
 2013-10-07  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Drawing video into canvas doesn't work on the first attempt
index 7a26b2c..7f657f5 100644 (file)
@@ -4,13 +4,103 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS getUserMedia succeeded.
+
+videoTrack = mediaStream.getVideoTracks()[0]
+PASS track.readyState is "live"
+checking track.capabilities()
+  sourceId
+    0 : 239c24b0-2b15-11e3-8224-0800200c9a66
+  sourceType
+    0 : camera
+    1 : microphone
+  width
+   min : 320
+   max : 1920
+   supported : true
+  height
+   min : 240
+   max : 1080
+   supported : true
+  frameRate
+   min : 15
+   max : 60
+   supported : true
+  aspectRatio
+   min : 1.3333333730697632
+   max : 1.7777777910232544
+   supported : true
+  facingMode
+    0 : user
+    1 : environment
+checking track.states()
+PASS states.sourceId is capabilities.sourceId[0]
+PASS states.sourceType is "camera"
+  width : 1920
+  height : 1080
+  frameRate : 30
+  aspectRatio : 1.7777777910232544
+  facingMode : user
+
+audioTrack = mediaStream.getAudioTracks()[0]
 PASS track.readyState is "live"
-PASS Track onmute callback succeeded.
-PASS track.readyState is "muted"
-PASS Track onunmute callback succeeded.
+checking track.capabilities()
+  sourceId
+    0 : 239c24b1-2b15-11e3-8224-0800200c9a66
+  volume
+   min : 0
+   max : 100
+   supported : true
+checking track.states()
+PASS states.sourceId is capabilities.sourceId[0]
+PASS states.sourceType is "microphone"
+  volume : 50
+
+videoTrack2 = videoTrack.clone()
 PASS track.readyState is "live"
+checking track.capabilities()
+  sourceId
+    0 : 239c24b0-2b15-11e3-8224-0800200c9a66
+  sourceType
+    0 : camera
+    1 : microphone
+  width
+   min : 320
+   max : 1920
+   supported : true
+  height
+   min : 240
+   max : 1080
+   supported : true
+  frameRate
+   min : 15
+   max : 60
+   supported : true
+  aspectRatio
+   min : 1.3333333730697632
+   max : 1.7777777910232544
+   supported : true
+  facingMode
+    0 : user
+    1 : environment
+checking track.states()
+PASS states.sourceId is capabilities.sourceId[0]
+PASS states.sourceType is "camera"
+  width : 1920
+  height : 1080
+  frameRate : 30
+  aspectRatio : 1.7777777910232544
+  facingMode : user
+PASS videoTrack.id is not videoTrack2.id
+PASS videoTrack.kind is videoTrack2.kind
+PASS videoTrack.label is videoTrack2.label
+PASS videoTrack.muted is videoTrack2.muted
+PASS videoTrack.enabled is videoTrack2.enabled
+PASS videoTrack.readyState is videoTrack2.readyState
+
+videoTrack.stop()
 PASS Track onended callback succeeded.
-PASS track.readyState is "ended"
+PASS videoTrack.readyState is "ended"
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 62eee79..0d0a43b 100644 (file)
@@ -7,10 +7,10 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 *** calling MediaStreamTrack.getSources() ***
 PASS MediaStreamTrack.getSources(gotSources1); did not throw exception.
 PASS callback called.
-sources1[0].sourceId = "Mock_audio_device_ID"
+sources1[0].sourceId = "239c24b1-2b15-11e3-8224-0800200c9a66"
 sources1[0].label = "Mock audio device"
 sources1[0].kind = "audio"
-sources1[1].sourceId = "Mock_video_device_ID"
+sources1[1].sourceId = "239c24b0-2b15-11e3-8224-0800200c9a66"
 sources1[1].label = "Mock video device"
 sources1[1].kind = "video"
 
index e3b6d3a..89d7f80 100644 (file)
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-description("Tests MediaStreamTrack callbacks.");
-
-// Note that the below behaviour doesn't reflect how it works outside of LayoutTests.
-// The underlying mock is modified to trigger the events when certain functions are called.
-// This modified behaviour allows us to test the MediaStreamTrack class properly.
-
-var stream;
-var track;
-
-function error() {
-    testFailed('Stream generation failed.');
-    finishJSTest();
-}
-
-function getUserMedia(constraints, callback) {
-    try {
-        navigator.webkitGetUserMedia(constraints, callback, error);
-    } catch (e) {
-        testFailed('webkitGetUserMedia threw exception :' + e);
-        finishJSTest();
-    }
-}
-
-function onTrackEnded() {
-    testPassed('Track onended callback succeeded.');
-
-    shouldBeEqualToString('track.readyState', 'ended');
-
-    finishJSTest();
-}
-
-function onTrackUnmute() {
-    testPassed('Track onunmute callback succeeded.');
-
-    shouldBeEqualToString('track.readyState', 'live');
-
-    stream.stop();
-}
-
-function onTrackMute() {
-    testPassed('Track onmute callback succeeded.');
-
-    shouldBeEqualToString('track.readyState', 'muted');
-
-    track.enabled = true;
-}
-
-function gotStream(s) {
-    testPassed('getUserMedia succeeded.');
-
-    stream = s;
-    track = stream.getVideoTracks()[0];
-
-    shouldBeEqualToString('track.readyState', 'live');
-
-    track.onunmute = onTrackUnmute;
-    track.onmute = onTrackMute;
-    track.onended = onTrackEnded;
-
-    track.enabled = false;
-}
-
-getUserMedia({audio:true, video:true}, gotStream);
-
-window.jsTestIsAsync = true;
-window.successfullyParsed = true;
-</script>
-<script src="../../resources/js-test-post.js"></script>
-</body>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script>
+            var mediaStream;
+            var videoTrack;
+            var videoTrack2;
+            var audioTrack;
+            
+            function error()
+            {
+                testFailed('Stream generation failed.');
+                finishJSTest();
+            }
+
+            function getUserMedia(constraints, callback)
+            {
+                try {
+                    navigator.webkitGetUserMedia(constraints, callback, error);
+                } catch (e) {
+                    testFailed('webkitGetUserMedia threw exception :' + e);
+                    finishJSTest();
+                }
+            }
+            
+            function onTrackEnded()
+            {
+                testPassed('Track onended callback succeeded.');
+                shouldBeEqualToString('videoTrack.readyState', 'ended');
+                debug("");
+                finishJSTest();
+            }
+
+            function onTrackStarted()
+            {
+                testPassed('Track onstarted callback succeeded.');
+                shouldBeEqualToString('videoTrack.readyState', 'live');
+            }
+
+            function onTrackOverConstrained()
+            {
+                testPassed('Track onoverconstrained callback succeeded.');
+                finishJSTest();
+            }
+
+            function onTrackUnmute()
+            {
+                testPassed('Track onunmute callback succeeded.');
+                shouldBeEqualToString('videoTrack.readyState', 'live');
+                videoTrack.stop();
+            }
+
+            function onTrackMute()
+            {
+                testPassed('Track onmute callback succeeded.');
+                shouldBeEqual('videoTrack.muted', true);
+            }
+
+            function logCapabilityRange(name, range)
+            {
+                debug("  " + name);
+                debug("   min : " + range.min);
+                debug("   max : " + range.max);
+                debug("   supported : " + range.supported);
+            }
+
+            function logCapabilityList(name, list)
+            {
+                debug("  " + name);
+                for (i = 0; i < list.length; i++)
+                debug("    " + i + " : " + list[i]);
+            }
+
+            function checkCapabilities(track)
+            {
+                debug("checking track.capabilities()");
+                capabilities = track.capabilities();
+                logCapabilityList("sourceId", capabilities.sourceId);
+                if (track.kind == "video") {
+                    logCapabilityList("sourceType", capabilities.sourceType);
+                    logCapabilityRange("width", capabilities.width);
+                    logCapabilityRange("height", capabilities.height);
+                    logCapabilityRange("frameRate", capabilities.frameRate);
+                    logCapabilityRange("aspectRatio", capabilities.aspectRatio);
+                    logCapabilityList("facingMode", capabilities.facingMode);
+                } else
+                    logCapabilityRange("volume", capabilities.volume);
+            }
+
+            function checkStates(track)
+            {
+                debug("checking track.states()");
+                capabilities = track.capabilities();
+                states = track.states();
+                shouldBe('states.sourceId', 'capabilities.sourceId[0]');
+                if (track.kind == "video") {
+                    shouldBeEqualToString('states.sourceType', 'camera');
+                    debug("  width : " + states.width);
+                    debug("  height : " + states.height);
+                    debug("  frameRate : " + states.frameRate);
+                    debug("  aspectRatio : " + states.aspectRatio);
+                    debug("  facingMode : " + states.facingMode);
+                } else {
+                    shouldBeEqualToString('states.sourceType', 'microphone');
+                    debug("  volume : " + states.volume);
+                }
+            }
+            
+            function checkTrack(t)
+            {
+                track = t;
+                shouldBeEqualToString('track.readyState', 'live');
+                checkCapabilities(track);
+                checkStates(track);
+            }
+
+            function gotStream(stream)
+            {
+                mediaStream = stream;
+                testPassed('getUserMedia succeeded.');
+            
+                debug("");
+                evalAndLog("videoTrack = mediaStream.getVideoTracks()[0]");
+                checkTrack(videoTrack);
+
+                debug("");
+                evalAndLog("audioTrack = mediaStream.getAudioTracks()[0]");
+                checkTrack(audioTrack);
+
+                videoTrack.onmute = onTrackMute;
+                videoTrack.onunmute = onTrackUnmute;
+                videoTrack.onended = onTrackEnded;
+                videoTrack.onstarted = onTrackStarted;
+                videoTrack.onoverconstrained = onTrackOverConstrained;
+            
+                debug("");
+                evalAndLog("videoTrack2 = videoTrack.clone()");
+                checkTrack(videoTrack2);
+                shouldNotBe('videoTrack.id', 'videoTrack2.id');
+                shouldBe('videoTrack.kind', 'videoTrack2.kind');
+                shouldBe('videoTrack.label', 'videoTrack2.label');
+                shouldBe('videoTrack.muted', 'videoTrack2.muted');
+                shouldBe('videoTrack.enabled', 'videoTrack2.enabled');
+                shouldBe('videoTrack.readyState', 'videoTrack2.readyState');
+
+                debug("");
+                evalAndLog("videoTrack.stop()");
+            }
+
+            function start()
+            {
+                description("Tests MediaStreamTrack callbacks.");
+                
+                // Note that the below behaviour doesn't reflect how it works outside of LayoutTests.
+                // The underlying mock is modified to trigger the events when certain functions are called.
+                // This modified behaviour allows us to test the MediaStreamTrack class properly.
+                getUserMedia({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 73c1965..1405a84 100644 (file)
@@ -186,12 +186,20 @@ set(WebCore_IDL_FILES
     Modules/mediasource/WebKitSourceBuffer.idl
     Modules/mediasource/WebKitSourceBufferList.idl
 
+    Modules/mediastream/AllAudioCapabilities.idl
+    Modules/mediastream/AllVideoCapabilities.idl
     Modules/mediastream/AudioStreamTrack.idl
+    Modules/mediastream/CapabilityRange.idl
+    Modules/mediastream/MediaSourceStates.idl
     Modules/mediastream/MediaStream.idl
+    Modules/mediastream/MediaStreamCapabilities.idl
     Modules/mediastream/MediaStreamEvent.idl
     Modules/mediastream/MediaStreamTrack.idl
     Modules/mediastream/MediaStreamTrackEvent.idl
     Modules/mediastream/MediaStreamTrackSourcesCallback.idl
+    Modules/mediastream/MediaTrackConstraint.idl
+    Modules/mediastream/MediaTrackConstraintSet.idl
+    Modules/mediastream/MediaTrackConstraints.idl
     Modules/mediastream/NavigatorMediaStream.idl
     Modules/mediastream/NavigatorUserMediaError.idl
     Modules/mediastream/NavigatorUserMediaErrorCallback.idl
@@ -786,13 +794,19 @@ set(WebCore_SOURCES
     Modules/mediasource/SourceBufferList.cpp
 
     Modules/mediastream/AudioStreamTrack.cpp
+    Modules/mediastream/CapabilityRange.cpp
     Modules/mediastream/MediaConstraintsImpl.cpp
+    Modules/mediastream/MediaSourceStates.cpp
     Modules/mediastream/MediaStream.cpp
+    Modules/mediastream/MediaStreamCapabilities.cpp
     Modules/mediastream/MediaStreamEvent.cpp
     Modules/mediastream/MediaStreamRegistry.cpp
     Modules/mediastream/MediaStreamTrack.cpp
     Modules/mediastream/MediaStreamTrackEvent.cpp
     Modules/mediastream/MediaStreamTrackSourcesRequest.cpp
+    Modules/mediastream/MediaTrackConstraint.cpp
+    Modules/mediastream/MediaTrackConstraintSet.cpp
+    Modules/mediastream/MediaTrackConstraints.cpp
     Modules/mediastream/NavigatorMediaStream.cpp
     Modules/mediastream/NavigatorUserMediaError.cpp
     Modules/mediastream/RTCDTMFSender.cpp
@@ -863,6 +877,7 @@ set(WebCore_SOURCES
     Modules/webaudio/GainNode.cpp
     Modules/webaudio/MediaElementAudioSourceNode.cpp
     Modules/webaudio/MediaStreamAudioDestinationNode.cpp
+    Modules/webaudio/MediaStreamAudioSource.cpp
     Modules/webaudio/MediaStreamAudioSourceNode.cpp
     Modules/webaudio/OfflineAudioCompletionEvent.cpp
     Modules/webaudio/OfflineAudioContext.cpp
index 0e1aef3..18b606e 100644 (file)
@@ -1,3 +1,178 @@
+2013-10-07  Eric Carlson  <eric.carlson@apple.com>
+
+        [MediaStream API] update MediaStreamTrack object to match spec
+        https://bugs.webkit.org/show_bug.cgi?id=121940
+
+        Reviewed by Jer Noble.
+
+        No new tests, existing test updated.
+
+        Add new source files to the project:
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * GNUmakefile.list.am:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        New capability dictionary objects:
+        * Modules/mediastream/AllAudioCapabilities.h: Added.
+        * Modules/mediastream/AllAudioCapabilities.idl: Added.
+        * Modules/mediastream/AllVideoCapabilities.h: Added.
+        * Modules/mediastream/AllVideoCapabilities.idl: Added.
+
+        * Modules/mediastream/AudioStreamTrack.cpp:
+        (WebCore::AudioStreamTrack::create): New version that takes a MediaStreamTrack*.
+        * Modules/mediastream/AudioStreamTrack.h:
+
+        New object for a capability range:
+        * Modules/mediastream/CapabilityRange.cpp: Added.
+        * Modules/mediastream/CapabilityRange.h: Added.
+        * Modules/mediastream/CapabilityRange.idl: Added.
+
+        * Modules/mediastream/MediaConstraintsImpl.h: Make initialize() public.
+
+        New object for the current states for a media source.
+        * Modules/mediastream/MediaSourceStates.cpp: Added.
+        * Modules/mediastream/MediaSourceStates.h: Added.
+        * Modules/mediastream/MediaSourceStates.idl: Added.
+
+        Don't call the media stream center to notify it when the state of other
+        objects change.
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::processTrack): Remove the stream source duplication hack.
+        (WebCore::createFromSourceVectors): 
+        (WebCore::MediaStream::MediaStream):
+        (WebCore::MediaStream::addTrack):
+        (WebCore::MediaStream::removeTrack):
+        * Modules/mediastream/MediaStream.h:
+
+        New object for the capabilities of a source.
+        * Modules/mediastream/MediaStreamCapabilities.cpp: Added.
+        * Modules/mediastream/MediaStreamCapabilities.h: Added.
+        * Modules/mediastream/MediaStreamCapabilities.idl: Added.
+
+        Update interface to match spec.
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::MediaStreamTrack): Define a copy constructor to use in clone().
+        (WebCore::MediaStreamTrack::setSource): Call removeObserver if the track already has a source.
+            Initialize m_muted from new source's muted state.
+        (WebCore::MediaStreamTrack::id): Allow source to provide ID as the spec suggests.
+        (WebCore::MediaStreamTrack::setEnabled): Add some spec text to clarify logic. Always call
+            source->setEnabled, it can figure out if nothing needs to be done.
+        (WebCore::MediaStreamTrack::muted): Don't call the stream center when muted changes, the
+            source can take care of notifying interested parties.
+        (WebCore::MediaStreamTrack::readonly): New.
+        (WebCore::MediaStreamTrack::remote): New.
+        (WebCore::MediaStreamTrack::constraints): New. 
+        (WebCore::MediaStreamTrack::states): New.
+        (WebCore::MediaStreamTrack::capabilities): New.
+        (WebCore::MediaStreamTrack::applyConstraints): New.
+        (WebCore::MediaStreamTrack::clone): New.
+        (WebCore::MediaStreamTrack::stopProducingData): New.
+        (WebCore::MediaStreamTrack::sourceStateChanged): Renamed from sourceChangedState.
+        (WebCore::MediaStreamTrack::sourceMutedChanged): New.
+        (WebCore::MediaStreamTrack::sourceEnabledChanged): New.
+        (WebCore::MediaStreamTrack::configureTrackRendering): New.
+        (WebCore::MediaStreamTrack::stopped): New. 
+        (WebCore::MediaStreamTrack::stop): Call stopProducingData.
+        (WebCore::MediaStreamTrack::scheduleEventDispatch): New.
+        (WebCore::MediaStreamTrack::dispatchQueuedEvents): New.
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/MediaStreamTrack.idl:
+
+        * Modules/mediastream/MediaTrackConstraint.cpp: Added.
+        * Modules/mediastream/MediaTrackConstraint.h: Added.
+        * Modules/mediastream/MediaTrackConstraint.idl: Added.
+
+        // Add empty classes/IDL for track constraint objects.
+        * Modules/mediastream/MediaTrackConstraintSet.cpp: Added.
+        * Modules/mediastream/MediaTrackConstraintSet.h: Added.
+        * Modules/mediastream/MediaTrackConstraintSet.idl: Added.
+        * Modules/mediastream/MediaTrackConstraints.cpp: Added.
+        * Modules/mediastream/MediaTrackConstraints.h: Added.
+        * Modules/mediastream/MediaTrackConstraints.idl: Added.
+
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::callSuccessHandler): Don't call the stream center, the
+            stream can take care of notifying interested parties.
+
+        // Add a constructor and create() that take a MediaStreamTrack*.
+        * Modules/mediastream/VideoStreamTrack.cpp:
+        (WebCore::VideoStreamTrack::create): 
+        (WebCore::VideoStreamTrack::VideoStreamTrack):
+        * Modules/mediastream/VideoStreamTrack.h:
+
+        // Create a MediaStreamSource subclass for WebAudio
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::createMediaStreamSource): Call isAudioStreamSource instead
+            of checking deviceID.
+        * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
+        (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): Create a
+            MediaStreamAudioSource instead of a MediaStreamSource.
+        * Modules/webaudio/MediaStreamAudioDestinationNode.h:
+        * Modules/webaudio/MediaStreamAudioSource.cpp: Added.
+        * Modules/webaudio/MediaStreamAudioSource.h: Added.
+        (WebCore::MediaStreamAudioSource::~MediaStreamAudioSource):
+
+        // Add new generated files.
+        * bindings/js/JSMediaSourceStatesCustom.cpp: Added.
+        * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Added.
+
+        * dom/EventNames.h: Defined 'overconstrained' event.
+
+        * platform/mediastream/MediaStreamCenter.h: Get rid of all of the methods nobody uses.
+            It isn't clear that they are necessary, and we can add them back if/when we need them.
+
+        * platform/mediastream/MediaStreamDescriptor.cpp:
+        (WebCore::MediaStreamDescriptor::~MediaStreamDescriptor): Clear the all source streams.
+        (WebCore::MediaStreamDescriptor::removeSource): Clear the source stream.
+        * platform/mediastream/MediaStreamDescriptor.h:
+
+        // Make MediaStreamSource an abstract base class, and remove everyting WebAudio-specific
+        //  to MediaStreamAudioSource. 
+        * platform/mediastream/MediaStreamSource.cpp:
+        (WebCore::MediaStreamSource::MediaStreamSource): Remove readyState and requiresConsumer
+            parameters. Create new UUID for id if non was passed.
+        (WebCore::MediaStreamSource::reset): Reset internal state to just-constructed. Used for testing.
+        (WebCore::MediaStreamSource::setReadyState): sourceChangedState -> sourceStateChanged.
+        (WebCore::MediaStreamSource::setStream): Remove the ASSERT that check for a source being
+            added to a new stream. This is still a problem, but it is required for testing and will
+            be fixed as a part of bug 121954.
+        (WebCore::MediaStreamSource::setConstraints): Added.
+        (WebCore::MediaStreamSource::setMuted): Notify observers when muted changes.
+        (WebCore::MediaStreamSource::setEnabled): Notify observers when enabled changes.
+        (WebCore::MediaStreamSource::readonly): New.
+        (WebCore::MediaStreamSource::stop): New. Set state to Ended when all of the observers has
+            stopped.
+        * platform/mediastream/MediaStreamSource.h:
+
+        // Define platform versions of the Capabilities classes.
+        * platform/mediastream/MediaStreamSourceCapabilities.h: Added.
+
+        // Update the non-functional platform stream centers for the API changes.
+        * platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp:
+        * platform/mediastream/blackberry/MediaStreamCenterBlackBerry.h:
+        * platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp:
+        * platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h:
+        * platform/mediastream/mac/MediaStreamCenterMac.cpp:
+        * platform/mediastream/mac/MediaStreamCenterMac.h:
+
+        // Update the Mock stream center for the API changes. Add a concrete mock MediaStreamSource
+        //  subclass.
+        * platform/mock/MockMediaStreamCenter.cpp:
+        (WebCore::MockSource::MockSource): New, the mock media stream source.
+        (WebCore::MockSource::~MockSource):
+        (WebCore::MockSource::capabilities):
+        (WebCore::MockSource::states):
+        (WebCore::mockSourceMap):
+        (WebCore::mockAudioSourceID):
+        (WebCore::mockVideoSourceID):
+        (WebCore::initializeMockSources): Create one audio and one video mock source.
+        (WebCore::MockMediaStreamCenter::registerMockMediaStreamCenter): Call initializeMockSources.
+        (WebCore::MockMediaStreamCenter::createMediaStream): Use the already allocated mock media
+            sources.
+        (WebCore::MockMediaStreamCenter::getMediaStreamTrackSources): Ditto.
+        * platform/mock/MockMediaStreamCenter.h:
+
 2013-10-07  Andreas Kling  <akling@apple.com>
 
         CTTE: Live node lists always have an owner Node.
index 0a3a21a..402f603 100644 (file)
@@ -101,12 +101,20 @@ BINDING_IDLS = \
     $(WebCore)/Modules/mediasource/WebKitSourceBufferList.idl \
     $(WebCore)/Modules/mediasource/SourceBuffer.idl \
     $(WebCore)/Modules/mediasource/SourceBufferList.idl \
+       $(WebCore)/Modules/mediastream/AllVideoCapabilities.idl \
+       $(WebCore)/Modules/mediastream/AllAudioCapabilities.idl \
        $(WebCore)/Modules/mediastream/AudioStreamTrack.idl \
+    $(WebCore)/Modules/mediastream/CapabilityRange.idl \
+    $(WebCore)/Modules/mediastream/MediaSourceStates.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 \
     $(WebCore)/Modules/mediastream/MediaStreamTrackSourcesCallback.idl \
+    $(WebCore)/Modules/mediastream/MediaTrackConstraint.idl \
+    $(WebCore)/Modules/mediastream/MediaTrackConstraints.idl \
+    $(WebCore)/Modules/mediastream/MediaTrackConstraintSet.idl \
     $(WebCore)/Modules/mediastream/NavigatorMediaStream.idl \
     $(WebCore)/Modules/mediastream/NavigatorUserMediaError.idl \
     $(WebCore)/Modules/mediastream/NavigatorUserMediaErrorCallback.idl \
index d4ff597..f3790bc 100644 (file)
@@ -31,6 +31,10 @@ webcore_built_sources += \
        DerivedSources/WebCore/InspectorProtocolVersion.h \
        DerivedSources/WebCore/JSAbstractWorker.cpp \
        DerivedSources/WebCore/JSAbstractWorker.h \
+       DerivedSources/WebCore/JSAllAudioCapabilities.cpp \
+       DerivedSources/WebCore/JSAllAudioCapabilities.h \
+       DerivedSources/WebCore/JSAllVideoCapabilities.cpp \
+       DerivedSources/WebCore/JSAllVideoCapabilities.h \
        DerivedSources/WebCore/JSAttr.cpp \
        DerivedSources/WebCore/JSAttr.h \
        DerivedSources/WebCore/JSAudioBuffer.cpp \
@@ -87,6 +91,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSCanvasRenderingContext2D.h \
        DerivedSources/WebCore/JSCanvasRenderingContext.cpp \
        DerivedSources/WebCore/JSCanvasRenderingContext.h \
+       DerivedSources/WebCore/JSCapabilityRange.cpp \
+       DerivedSources/WebCore/JSCapabilityRange.h \
        DerivedSources/WebCore/JSCDATASection.cpp \
        DerivedSources/WebCore/JSCDATASection.h \
        DerivedSources/WebCore/JSCharacterData.cpp \
@@ -462,12 +468,16 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSMediaSource.h \
        DerivedSources/WebCore/JSWebKitMediaSource.cpp \
        DerivedSources/WebCore/JSWebKitMediaSource.h \
+       DerivedSources/WebCore/JSMediaSourceStates.cpp \
+       DerivedSources/WebCore/JSMediaSourceStates.h \
        DerivedSources/WebCore/JSMediaStream.cpp \
        DerivedSources/WebCore/JSMediaStream.h \
        DerivedSources/WebCore/JSMediaStreamAudioSourceNode.cpp \
        DerivedSources/WebCore/JSMediaStreamAudioSourceNode.h \
        DerivedSources/WebCore/JSMediaStreamAudioDestinationNode.cpp \
        DerivedSources/WebCore/JSMediaStreamAudioDestinationNode.h \
+       DerivedSources/WebCore/JSMediaStreamCapabilities.cpp \
+       DerivedSources/WebCore/JSMediaStreamCapabilities.h \
        DerivedSources/WebCore/JSMediaStreamEvent.cpp \
        DerivedSources/WebCore/JSMediaStreamEvent.h \
        DerivedSources/WebCore/JSMediaStreamTrack.cpp \
@@ -480,6 +490,12 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSMediaQueryList.h \
        DerivedSources/WebCore/JSMediaQueryListListener.cpp \
        DerivedSources/WebCore/JSMediaQueryListListener.h \
+       DerivedSources/WebCore/JSMediaTrackConstraint.cpp \
+       DerivedSources/WebCore/JSMediaTrackConstraint.h \
+       DerivedSources/WebCore/JSMediaTrackConstraints.cpp \
+       DerivedSources/WebCore/JSMediaTrackConstraints.h \
+       DerivedSources/WebCore/JSMediaTrackConstraintSet.cpp \
+       DerivedSources/WebCore/JSMediaTrackConstraintSet.h \
        DerivedSources/WebCore/JSMessageChannel.cpp \
        DerivedSources/WebCore/JSMessageChannel.h \
        DerivedSources/WebCore/JSMessageEvent.cpp \
@@ -1186,12 +1202,20 @@ dom_binding_idls += \
        $(WebCore)/Modules/mediasource/WebKitMediaSource.idl \
        $(WebCore)/Modules/mediasource/WebKitSourceBuffer.idl \
        $(WebCore)/Modules/mediasource/WebKitSourceBufferList.idl \
+       $(WebCore)/Modules/mediastream/AllVideoCapabilities.idl \
+       $(WebCore)/Modules/mediastream/AllAudioCapabilities.idl \
        $(WebCore)/Modules/mediastream/AudioStreamTrack.idl \
+       $(WebCore)/Modules/mediastream/CapabilityRange.idl \
+       $(WebCore)/Modules/mediastream/MediaSourceStates.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 \
        $(WebCore)/Modules/mediastream/MediaStreamTrackSourcesCallback.idl \
+       $(WebCore)/Modules/mediastream/MediaTrackConstraint.idl \
+       $(WebCore)/Modules/mediastream/MediaTrackConstraints.idl \
+       $(WebCore)/Modules/mediastream/MediaTrackConstraintSet.idl \
        $(WebCore)/Modules/mediastream/NavigatorMediaStream.idl \
        $(WebCore)/Modules/mediastream/NavigatorUserMediaError.idl \
        $(WebCore)/Modules/mediastream/NavigatorUserMediaErrorCallback.idl \
@@ -1845,12 +1869,20 @@ webcore_modules_sources += \
        Source/WebCore/Modules/mediasource/WebKitSourceBuffer.h \
        Source/WebCore/Modules/mediasource/WebKitSourceBufferList.cpp \
        Source/WebCore/Modules/mediasource/WebKitSourceBufferList.h \
+       Source/WebCore/Modules/mediastream/AllAudioCapabilities.h \
+       Source/WebCore/Modules/mediastream/AllVideoCapabilities.h \
        Source/WebCore/Modules/mediastream/AudioStreamTrack.cpp \
        Source/WebCore/Modules/mediastream/AudioStreamTrack.h \
+       Source/WebCore/Modules/mediastream/CapabilityRange.cpp \
+       Source/WebCore/Modules/mediastream/CapabilityRange.h \
        Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp \
        Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h \
+       Source/WebCore/Modules/mediastream/MediaSourceStates.cpp \
+       Source/WebCore/Modules/mediastream/MediaSourceStates.h \
        Source/WebCore/Modules/mediastream/MediaStream.cpp \
        Source/WebCore/Modules/mediastream/MediaStream.h \
+       Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp \
+       Source/WebCore/Modules/mediastream/MediaStreamCapabilities.h \
        Source/WebCore/Modules/mediastream/MediaStreamEvent.cpp \
        Source/WebCore/Modules/mediastream/MediaStreamEvent.h \
        Source/WebCore/Modules/mediastream/MediaStreamRegistry.cpp \
@@ -1862,6 +1894,12 @@ webcore_modules_sources += \
        Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesCallback.h \
        Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesRequest.cpp \
        Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesRequest.h \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraint.cpp \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraint.h \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.cpp \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.h \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp \
+       Source/WebCore/Modules/mediastream/MediaTrackConstraints.h \
        Source/WebCore/Modules/mediastream/NavigatorMediaStream.cpp \
        Source/WebCore/Modules/mediastream/NavigatorMediaStream.h \
        Source/WebCore/Modules/mediastream/NavigatorUserMediaError.cpp \
@@ -2007,6 +2045,8 @@ webcore_modules_sources += \
        Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.h \
        Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp \
        Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h \
+       Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp \
+       Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h \
        Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp \
        Source/WebCore/Modules/webaudio/OfflineAudioContext.h \
        Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h \
@@ -2312,6 +2352,7 @@ webcore_sources += \
        Source/WebCore/bindings/js/JSMainThreadExecState.cpp \
        Source/WebCore/bindings/js/JSMainThreadExecState.h \
        Source/WebCore/bindings/js/JSMediaListCustom.h \
+       Source/WebCore/bindings/js/JSMediaSourceStatesCustom.cpp \
        Source/WebCore/bindings/js/JSMessageChannelCustom.cpp \
        Source/WebCore/bindings/js/JSMessageEventCustom.cpp \
        Source/WebCore/bindings/js/JSMessagePortCustom.cpp \
@@ -5336,6 +5377,7 @@ webcore_platform_sources += \
        Source/WebCore/platform/mediastream/MediaStreamDescriptor.h \
        Source/WebCore/platform/mediastream/MediaStreamSource.cpp \
        Source/WebCore/platform/mediastream/MediaStreamSource.h \
+       Source/WebCore/platform/mediastream/MediaStreamSourceCapabilities.h \
        Source/WebCore/platform/mediastream/MediaStreamTrackSourcesRequestClient.h \
        Source/WebCore/platform/mediastream/RTCConfiguration.h \
        Source/WebCore/platform/mediastream/RTCDTMFSenderHandler.h \
diff --git a/Source/WebCore/Modules/mediastream/AllAudioCapabilities.h b/Source/WebCore/Modules/mediastream/AllAudioCapabilities.h
new file mode 100644 (file)
index 0000000..5329564
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "MediaStreamSourceCapabilities.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CapabilityRange;
+class MediaStreamSourceCapabilities;
+
+class AllAudioCapabilities : public MediaStreamCapabilities {
+public:
+    static RefPtr<AllAudioCapabilities> create(PassRefPtr<MediaStreamSourceCapabilities> capabilities)
+    {
+        return adoptRef(new AllAudioCapabilities(capabilities));
+    }
+    virtual ~AllAudioCapabilities() { }
+
+private:
+    explicit AllAudioCapabilities(PassRefPtr<MediaStreamSourceCapabilities> 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
new file mode 100644 (file)
index 0000000..dfb3a6e
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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
new file mode 100644 (file)
index 0000000..667f214
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 MediaStreamSourceCapabilities;
+
+class AllVideoCapabilities : public MediaStreamCapabilities {
+public:
+    static RefPtr<AllVideoCapabilities> create(PassRefPtr<MediaStreamSourceCapabilities> capabilities)
+    {
+        return adoptRef(new AllVideoCapabilities(capabilities));
+    }
+    virtual ~AllVideoCapabilities() { }
+
+private:
+    explicit AllVideoCapabilities(PassRefPtr<MediaStreamSourceCapabilities> 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
new file mode 100644 (file)
index 0000000..515137c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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;
+};
index da8f30f..3ec057a 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<AudioStreamTrack> AudioStreamTrack::create(ScriptExecutionContext* context, const Dictionary& audioConstraints)
+RefPtr<AudioStreamTrack> AudioStreamTrack::create(ScriptExecutionContext* context, const Dictionary& audioConstraints)
 {
-    RefPtr<AudioStreamTrack> track = adoptRef(new AudioStreamTrack(context, 0, &audioConstraints));
-    return track.release();
+    return adoptRef(new AudioStreamTrack(context, 0, &audioConstraints));
 }
 
-PassRefPtr<AudioStreamTrack> AudioStreamTrack::create(ScriptExecutionContext* context, MediaStreamSource* source)
+RefPtr<AudioStreamTrack> AudioStreamTrack::create(ScriptExecutionContext* context, MediaStreamSource* source)
 {
-    RefPtr<AudioStreamTrack> track = adoptRef(new AudioStreamTrack(context, source, 0));
-    return track.release();
+    return adoptRef(new AudioStreamTrack(context, source, 0));
+}
+
+RefPtr<AudioStreamTrack> AudioStreamTrack::create(MediaStreamTrack* track)
+{
+    return adoptRef(new AudioStreamTrack(track));
 }
 
 AudioStreamTrack::AudioStreamTrack(ScriptExecutionContext* context, MediaStreamSource* source, const Dictionary* audioConstraints)
@@ -52,6 +55,11 @@ AudioStreamTrack::AudioStreamTrack(ScriptExecutionContext* context, MediaStreamS
 {
 }
 
+AudioStreamTrack::AudioStreamTrack(MediaStreamTrack* track)
+    : MediaStreamTrack(track)
+{
+}
+
 const AtomicString& AudioStreamTrack::kind() const
 {
     static NeverDestroyed<AtomicString> audioKind("audio", AtomicString::ConstructFromLiteral);
index 39984a6..18c89f5 100644 (file)
@@ -29,8 +29,8 @@
 #if ENABLE(MEDIA_STREAM)
 
 #include "MediaStreamTrack.h"
-#include <wtf/Vector.h>
 #include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
@@ -39,8 +39,9 @@ class ScriptExecutionContext;
 
 class AudioStreamTrack FINAL : public MediaStreamTrack {
 public:
-    static PassRefPtr<AudioStreamTrack> create(ScriptExecutionContext*, const Dictionary&);
-    static PassRefPtr<AudioStreamTrack> create(ScriptExecutionContext*, MediaStreamSource*);
+    static RefPtr<AudioStreamTrack> create(ScriptExecutionContext*, const Dictionary&);
+    static RefPtr<AudioStreamTrack> create(ScriptExecutionContext*, MediaStreamSource*);
+    static RefPtr<AudioStreamTrack> create(MediaStreamTrack*);
 
     virtual ~AudioStreamTrack() { }
 
@@ -48,6 +49,7 @@ public:
 
 private:
     AudioStreamTrack(ScriptExecutionContext*, MediaStreamSource*, const Dictionary*);
+    explicit AudioStreamTrack(MediaStreamTrack*);
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/Modules/mediastream/CapabilityRange.cpp b/Source/WebCore/Modules/mediastream/CapabilityRange.cpp
new file mode 100644 (file)
index 0000000..0d3d26e
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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 COMPUTER, 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 "MediaSourceStates.h"
+#include "ScriptValue.h"
+#include <interpreter/CallFrame.h>
+#include <runtime/JSCJSValue.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+RefPtr<CapabilityRange> CapabilityRange::create(const MediaStreamSourceCapabilityRange& rangeInfo)
+{
+    return adoptRef(new CapabilityRange(rangeInfo));
+}
+
+CapabilityRange::CapabilityRange(const MediaStreamSourceCapabilityRange& rangeInfo)
+    : m_rangeInfo(rangeInfo)
+{
+}
+
+static ScriptValue scriptValue(ExecState* exec, const MediaStreamSourceCapabilityRange::ValueUnion& value, MediaStreamSourceCapabilityRange::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 MediaStreamSourceCapabilityRange::Float:
+        return ScriptValue(exec->vm(), JSValue(value.asFloat));
+        break;
+    case MediaStreamSourceCapabilityRange::ULong:
+        return ScriptValue(exec->vm(), JSValue(value.asULong));
+        break;
+    case MediaStreamSourceCapabilityRange::Undefined:
+        return ScriptValue(exec->vm(), jsUndefined());
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return ScriptValue(exec->vm(), jsUndefined());
+}
+
+ScriptValue CapabilityRange::min(ExecState* exec) const
+{
+    return scriptValue(exec, m_rangeInfo.min(), m_rangeInfo.type());
+}
+
+ScriptValue CapabilityRange::max(ExecState* exec) const
+{
+    return scriptValue(exec, 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
new file mode 100644 (file)
index 0000000..3684066
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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 COMPUTER, 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 "MediaStreamSourceCapabilities.h"
+#include "ScriptValue.h"
+#include "ScriptWrappable.h"
+#include <interpreter/CallFrame.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class CapabilityRange : public RefCounted<CapabilityRange>, public ScriptWrappable {
+public:
+    virtual ~CapabilityRange() { }
+
+    static RefPtr<CapabilityRange> create(const MediaStreamSourceCapabilityRange&);
+
+    ScriptValue min(JSC::ExecState*) const;
+    ScriptValue max(JSC::ExecState*) const;
+    bool supported() const { return m_rangeInfo.supported(); }
+
+private:
+    CapabilityRange(const MediaStreamSourceCapabilityRange&);
+    
+    MediaStreamSourceCapabilityRange m_rangeInfo;
+};
+
+} // namespace WebCore
+
+#endif // CapabilityRange_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/CapabilityRange.idl b/Source/WebCore/Modules/mediastream/CapabilityRange.idl
new file mode 100644 (file)
index 0000000..3dc6f13
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 5d1fd90..1372a87 100644 (file)
@@ -45,7 +45,9 @@ class MediaConstraintsImpl : public MediaConstraints {
 public:
     static PassRefPtr<MediaConstraintsImpl> create();
     static PassRefPtr<MediaConstraintsImpl> create(const Dictionary&, ExceptionCode&);
+
     virtual ~MediaConstraintsImpl();
+    bool initialize(const Dictionary&);
 
     virtual void getMandatoryConstraints(Vector<MediaConstraint>&) const OVERRIDE;
     virtual void getOptionalConstraints(Vector<MediaConstraint>&) const OVERRIDE;
@@ -55,7 +57,6 @@ public:
 
 private:
     MediaConstraintsImpl() { }
-    bool initialize(const Dictionary&);
 
     HashMap<String, String> m_mandatoryConstraints;
     Vector<MediaConstraint> m_optionalConstraints;
diff --git a/Source/WebCore/Modules/mediastream/MediaSourceStates.cpp b/Source/WebCore/Modules/mediastream/MediaSourceStates.cpp
new file mode 100644 (file)
index 0000000..7c91b24
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "MediaSourceStates.h"
+
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+RefPtr<MediaSourceStates> MediaSourceStates::create(const MediaStreamSourceStates& states)
+{
+    return adoptRef(new MediaSourceStates(states));
+}
+
+MediaSourceStates::MediaSourceStates(const MediaStreamSourceStates& states)
+    : m_SourceStates(states)
+{
+}
+
+const AtomicString& MediaSourceStates::facingMode(MediaStreamSourceStates::VideoFacingMode mode)
+{
+    static NeverDestroyed<AtomicString> userFacing("user", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> environmentFacing("environment", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> leftFacing("left", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> rightFacing("right", AtomicString::ConstructFromLiteral);
+    
+    switch (mode) {
+    case MediaStreamSourceStates::User:
+        return userFacing;
+    case MediaStreamSourceStates::Environment:
+        return environmentFacing;
+    case MediaStreamSourceStates::Left:
+        return leftFacing;
+    case MediaStreamSourceStates::Right:
+        return rightFacing;
+    }
+
+    ASSERT_NOT_REACHED();
+    return emptyAtom;
+}
+
+const AtomicString& MediaSourceStates::sourceType(MediaStreamSourceStates::SourceType sourceType)
+{
+    static NeverDestroyed<AtomicString> none("none", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> camera("camera", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> microphone("microphone", AtomicString::ConstructFromLiteral);
+
+    switch (sourceType) {
+    case MediaStreamSourceStates::None:
+        return none;
+    case MediaStreamSourceStates::Camera:
+        return camera;
+    case MediaStreamSourceStates::Microphone:
+        return microphone;
+    }
+
+    ASSERT_NOT_REACHED();
+    return emptyAtom;
+}
+
+const AtomicString& MediaSourceStates::sourceType() const
+{
+    return MediaSourceStates::sourceType(m_SourceStates.sourceType);
+}
+
+const AtomicString& MediaSourceStates::facingMode() const
+{
+    return MediaSourceStates::facingMode(m_SourceStates.facingMode);
+}
+
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaSourceStates.h b/Source/WebCore/Modules/mediastream/MediaSourceStates.h
new file mode 100644 (file)
index 0000000..fb4c8f3
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 MediaSourceStates_h
+#define MediaSourceStates_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamSourceCapabilities.h"
+#include "ScriptWrappable.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class MediaSourceStates : public RefCounted<MediaSourceStates>, public ScriptWrappable {
+public:
+    static RefPtr<MediaSourceStates> create(const MediaStreamSourceStates&);
+
+    static const AtomicString& sourceType(MediaStreamSourceStates::SourceType);
+    static const AtomicString& facingMode(MediaStreamSourceStates::VideoFacingMode);
+    
+    const AtomicString& sourceType() const;
+    const AtomicString& sourceId() const { return m_SourceStates.sourceId; }
+    unsigned long width() const { return m_SourceStates.width; }
+    unsigned long height() const { return m_SourceStates.height; }
+    float frameRate() const { return m_SourceStates.frameRate; }
+    float aspectRatio() const { return m_SourceStates.aspectRatio; }
+    const AtomicString& facingMode() const;
+    unsigned long volume() const { return m_SourceStates.volume; }
+    
+    bool hasVideoSource() const { return m_SourceStates.sourceType == MediaStreamSourceStates::Camera; }
+
+private:
+    explicit MediaSourceStates(const MediaStreamSourceStates&);
+
+    MediaStreamSourceStates m_SourceStates;
+};
+
+} // namespace WebCore
+
+#endif // MediaSourceStates_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaSourceStates.idl b/Source/WebCore/Modules/mediastream/MediaSourceStates.idl
new file mode 100644 (file)
index 0000000..53f1236
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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. 
+ */
+
+enum SourceTypeEnum { "none", "camera", "microphone" };
+enum VideoFacingModeEnum { "user", "environment", "left", "right" };
+
+[
+    Conditional=MEDIA_STREAM,
+    ImplementationLacksVTable,
+    NoInterfaceObject,
+] interface MediaSourceStates {
+    readonly attribute SourceTypeEnum sourceType;
+    readonly attribute DOMString sourceId;
+
+    [CustomGetter] readonly attribute unsigned long width;
+    [CustomGetter] readonly attribute unsigned long height;
+    [CustomGetter] readonly attribute float frameRate;
+    [CustomGetter] readonly attribute float aspectRatio;
+    [CustomGetter] readonly attribute VideoFacingModeEnum facingMode;
+    [CustomGetter] readonly attribute unsigned long volume;
+};
+
index eeae370..74678aa 100644 (file)
@@ -56,22 +56,13 @@ static void processTrack(MediaStreamTrack* track, MediaStreamSourceVector& sourc
         return;
 
     MediaStreamSource* source = track->source();
-    if (!containsSource(sourceVector, source)) {
-        if (source->stream()) {
-            // FIXME: this should not be necessary because tracks and streams must be able to share sources, but our code
-            // currenlty assumes each source is attached to just one track.
-            // https://bugs.webkit.org/show_bug.cgi?id=121954
-            sourceVector.append(MediaStreamSource::create(source->id(), source->type(), source->name(), source->readyState(), source->requiresAudioConsumer()).get());
-        } else
-            sourceVector.append(source);
-    }
+    if (!containsSource(sourceVector, source))
+        sourceVector.append(source);
 }
 
 static PassRefPtr<MediaStream> createFromSourceVectors(ScriptExecutionContext* context, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
 {
     RefPtr<MediaStreamDescriptor> descriptor = MediaStreamDescriptor::create(audioSources, videoSources);
-    MediaStreamCenter::shared().didCreateMediaStream(descriptor.get());
-
     return MediaStream::create(context, descriptor.release());
 }
 
@@ -121,6 +112,7 @@ MediaStream::MediaStream(ScriptExecutionContext* context, PassRefPtr<MediaStream
     , m_descriptor(streamDescriptor)
     , m_scheduledEventTimer(this, &MediaStream::scheduledEventTimerFired)
 {
+    ASSERT(m_descriptor);
     m_descriptor->setClient(this);
 
     size_t numberOfAudioTracks = m_descriptor->numberOfAudioStreams();
@@ -156,7 +148,6 @@ void MediaStream::stop()
     if (ended())
         return;
 
-    MediaStreamCenter::shared().didStopLocalMediaStream(descriptor());
     setEnded();
 }
 
@@ -184,8 +175,6 @@ void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode&
         m_videoTracks.append(track);
         break;
     }
-
-    MediaStreamCenter::shared().didAddMediaStreamTrack(track->source());
 }
 
 void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode& ec)
@@ -223,8 +212,6 @@ void MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCo
 
     if (!m_audioTracks.size() && !m_videoTracks.size())
         setEnded();
-
-    MediaStreamCenter::shared().didRemoveMediaStreamTrack(track->source());
 }
 
 MediaStreamTrack* MediaStream::getTrackById(String id)
index d9cfe7a..a617f1d 100644 (file)
@@ -85,20 +85,18 @@ protected:
     MediaStream(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>);
 
     // ContextDestructionObserver
-    virtual void contextDestroyed() OVERRIDE;
+    virtual void contextDestroyed() OVERRIDE FINAL;
 
 private:
-    // MediaStreamDescriptorClient
-    virtual void trackDidEnd() OVERRIDE;
-    virtual void streamDidEnd() OVERRIDE;
-    
     // EventTarget
-    virtual void refEventTarget() OVERRIDE { ref(); }
-    virtual void derefEventTarget() OVERRIDE { deref(); }
+    virtual void refEventTarget() OVERRIDE FINAL { ref(); }
+    virtual void derefEventTarget() OVERRIDE FINAL { deref(); }
 
     // MediaStreamDescriptorClient
-    virtual void addRemoteSource(MediaStreamSource*) OVERRIDE;
-    virtual void removeRemoteSource(MediaStreamSource*) OVERRIDE;
+    virtual void trackDidEnd() OVERRIDE FINAL;
+    virtual void streamDidEnd() OVERRIDE FINAL;
+    virtual void addRemoteSource(MediaStreamSource*) OVERRIDE FINAL;
+    virtual void removeRemoteSource(MediaStreamSource*) OVERRIDE FINAL;
 
     void scheduleDispatchEvent(PassRefPtr<Event>);
     void scheduledEventTimerFired(Timer<MediaStream>*);
diff --git a/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp b/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp
new file mode 100644 (file)
index 0000000..08f41e2
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "MediaSourceStates.h"
+#include "MediaStreamSourceCapabilities.h"
+
+namespace WebCore {
+
+RefPtr<MediaStreamCapabilities> MediaStreamCapabilities::create(PassRefPtr<MediaStreamSourceCapabilities> capabilities)
+{
+    if (capabilities->hasVideoSource())
+        return AllVideoCapabilities::create(capabilities);
+    
+    return AllAudioCapabilities::create(capabilities);
+}
+
+MediaStreamCapabilities::MediaStreamCapabilities(PassRefPtr<MediaStreamSourceCapabilities> capabilities)
+    : m_SourceCapabilities(capabilities)
+{
+}
+
+Vector<String> MediaStreamCapabilities::sourceType() const
+{
+    ASSERT(m_SourceCapabilities->hasVideoSource());
+    
+    size_t count = m_SourceCapabilities->sourceTypes().size();
+    if (!count)
+        return Vector<String>();
+    
+    const Vector<MediaStreamSourceStates::SourceType>& sourceTypes = m_SourceCapabilities->sourceTypes();
+    Vector<String> capabilities;
+    capabilities.reserveCapacity(count);
+    
+    for (size_t i = 0; i < count; ++i)
+        capabilities.append(MediaSourceStates::sourceType(sourceTypes[i]));
+    
+    return capabilities;
+}
+
+Vector<String> MediaStreamCapabilities::sourceId() const
+{
+    size_t count = m_SourceCapabilities->sourceId().size();
+    if (!count)
+        return Vector<String>();
+    
+    const Vector<AtomicString>& sourceIds = m_SourceCapabilities->sourceId();
+    Vector<String> capabilities;
+    capabilities.reserveCapacity(count);
+    
+    for (size_t i = 0; i < count; ++i)
+        capabilities.append(sourceIds[i]);
+    
+    return capabilities;
+}
+
+Vector<String> MediaStreamCapabilities::facingMode() const
+{
+    ASSERT(m_SourceCapabilities->hasVideoSource());
+    
+    size_t count = m_SourceCapabilities->facingModes().size();
+    if (!count)
+        return Vector<String>();
+    
+    const Vector<MediaStreamSourceStates::VideoFacingMode>& facingModes = m_SourceCapabilities->facingModes();
+    Vector<String> capabilities;
+    capabilities.reserveCapacity(count);
+    
+    for (size_t i = 0; i < count; ++i)
+        capabilities.append(MediaSourceStates::facingMode(facingModes[i]));
+    
+    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
new file mode 100644 (file)
index 0000000..5ad3412
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "MediaStreamSourceCapabilities.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CapabilityRange;
+class MediaStreamSourceCapabilities;
+
+class MediaStreamCapabilities : public RefCounted<MediaStreamCapabilities>, public ScriptWrappable {
+public:
+    static RefPtr<MediaStreamCapabilities> create(PassRefPtr<MediaStreamSourceCapabilities>);
+    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<MediaStreamSourceCapabilities>);
+
+    RefPtr<MediaStreamSourceCapabilities> m_SourceCapabilities;
+};
+
+} // namespace WebCore
+
+#endif // MediaStreamCapabilities_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl b/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.idl
new file mode 100644 (file)
index 0000000..dd71ccb
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 9c7db22..01bbcdc 100644 (file)
 
 #if ENABLE(MEDIA_STREAM)
 
+#include "AllAudioCapabilities.h"
+#include "AllVideoCapabilities.h"
+#include "AudioStreamTrack.h"
 #include "Dictionary.h"
 #include "Event.h"
 #include "ExceptionCode.h"
+#include "MediaConstraintsImpl.h"
+#include "MediaSourceStates.h"
 #include "MediaStream.h"
 #include "MediaStreamCenter.h"
 #include "MediaStreamDescriptor.h"
 #include "MediaStreamTrackSourcesCallback.h"
 #include "MediaStreamTrackSourcesRequest.h"
+#include "MediaTrackConstraints.h"
+#include "NotImplemented.h"
 #include "UUID.h"
+#include "VideoStreamTrack.h"
+#include <wtf/Functional.h>
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
 MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext* context, MediaStreamSource* source, const Dictionary*)
     : ActiveDOMObject(context)
-    , m_source(source)
+    , m_source(0)
     , m_readyState(MediaStreamSource::New)
     , m_stopped(false)
     , m_enabled(true)
     , m_muted(false)
+    , m_eventDispatchScheduled(false)
 {
     suspendIfNeeded();
-    if (m_source) {
-        m_source->addObserver(this);
-        m_muted = m_source->muted();
-    }
+    if (source)
+        setSource(source);
+}
+
+MediaStreamTrack::MediaStreamTrack(MediaStreamTrack* other)
+    : ActiveDOMObject(other->scriptExecutionContext())
+{
+    suspendIfNeeded();
+
+    // When the clone() method is invoked, the user agent must run the following steps:
+    // 1. Let trackClone be a newly constructed MediaStreamTrack object.
+    // 2. Initialize trackClone's id attribute to a newly generated value.
+    m_id = createCanonicalUUIDString();
+
+    // 3. Let trackClone inherit this track's underlying source, kind, label and enabled attributes.
+    setSource(other->source());
+    m_readyState = m_source ? m_source->readyState() : MediaStreamSource::New;
+    m_enabled = other->enabled();
+
+    // Note: the "clone" steps don't say anything about 'muted', but 4.3.1 says:
+    // For a newly created MediaStreamTrack object, the following applies. The track is always enabled
+    // unless stated otherwise (for examlpe when cloned) and the muted state reflects the state of the
+    // source at the time the track is created.
+    m_muted = other->muted();
+
+    m_eventDispatchScheduled =false;
+    m_stopped = other->stopped();
 }
 
 MediaStreamTrack::~MediaStreamTrack()
@@ -84,7 +117,16 @@ const AtomicString& MediaStreamTrack::kind() const
 
 void MediaStreamTrack::setSource(MediaStreamSource* source)
 {
-    ASSERT(source == m_source || !m_source);
+    ASSERT(!source || !m_source);
+
+    if (m_source)
+        m_source->removeObserver(this);
+
+    if (source) {
+        source->addObserver(this);
+        m_muted = source->muted();
+    }
+
     m_source = source;
 }
 
@@ -93,18 +135,13 @@ const String& MediaStreamTrack::id() const
     if (!m_id.isEmpty())
         return m_id;
 
-    if (!m_source)
-        return emptyString();
-
-    const String& id = m_source->id();
-    if (!id.isEmpty())
-        return id;
-
     // The spec says:
     //   Unless a MediaStreamTrack object is created as a part a of special purpose algorithm that
     //   specifies how the track id must be initialized, the user agent must generate a globally
     //   unique identifier string and initialize the object's id attribute to that string.
-    // so generate a UUID if the source doesn't have an ID.
+    if (m_source && m_source->useIDForTrackID())
+        return m_source->id();
+
     m_id = createCanonicalUUIDString();
     return m_id;
 }
@@ -125,18 +162,40 @@ void MediaStreamTrack::setEnabled(bool enabled)
 {
     if (m_stopped)
         return;
-    
+
+    // 4.3.3.1
+    // ... after a MediaStreamTrack is disassociated from its track, its enabled attribute still
+    // changes value when set; it just doesn't do anything with that new value.
     m_enabled = enabled;
 
-    if (!m_source || enabled == m_source->enabled())
+    if (!m_source)
         return;
 
     m_source->setEnabled(enabled);
+}
 
-    if (m_source->stream()->ended())
-        return;
+bool MediaStreamTrack::muted() const
+{
+    if (m_stopped || !m_source)
+        return false;
+
+    return m_source->muted();
+}
+
+bool MediaStreamTrack::readonly() const
+{
+    if (m_stopped || !m_source)
+        return true;
 
-    MediaStreamCenter::shared().didSetMediaStreamTrackEnabled(m_source.get());
+    return m_source->readonly();
+}
+
+bool MediaStreamTrack::remote() const
+{
+    if (!m_source)
+        return false;
+
+    return m_source->remote();
 }
 
 const AtomicString& MediaStreamTrack::readyState() const
@@ -171,12 +230,64 @@ void MediaStreamTrack::getSources(ScriptExecutionContext* context, PassRefPtr<Me
         ec = NOT_SUPPORTED_ERR;
 }
 
+RefPtr<MediaTrackConstraints> MediaStreamTrack::constraints() const
+{
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=122428
+    notImplemented();
+    return 0;
+}
+
+RefPtr<MediaSourceStates> MediaStreamTrack::states() const
+{
+    if (!m_source)
+        return 0;
+    
+    return MediaSourceStates::create(m_source->states());
+}
+
+RefPtr<MediaStreamCapabilities> MediaStreamTrack::capabilities() const
+{
+    if (!m_source)
+        return 0;
+
+    return MediaStreamCapabilities::create(m_source->capabilities());
+}
+
+void MediaStreamTrack::applyConstraints(const Dictionary& constraints)
+{
+    // FIXME: apply the new constraints to the track
+    // https://bugs.webkit.org/show_bug.cgi?id=122428
+    m_constraints->initialize(constraints);
+}
+
+RefPtr<MediaStreamTrack> MediaStreamTrack::clone()
+{
+    if (m_source && m_source->type() == MediaStreamSource::Audio)
+        return AudioStreamTrack::create(this);
+
+    return VideoStreamTrack::create(this);
+}
+
+void MediaStreamTrack::stopProducingData()
+{
+    if (m_stopped || !m_source)
+        return;
+
+    // Set m_stopped before stopping the source because that may result in a call to sourceChangedState
+    // and we only want to dispatch the 'ended' event if necessary.
+    m_stopped = true;
+    m_source->stop();
+
+    if (m_readyState != MediaStreamSource::Ended)
+        scheduleEventDispatch(Event::create(eventNames().endedEvent, false, false));
+}
+
 bool MediaStreamTrack::ended() const
 {
     return m_stopped || (m_source && m_source->readyState() == MediaStreamSource::Ended);
 }
 
-void MediaStreamTrack::sourceChangedState()
+void MediaStreamTrack::sourceStateChanged()
 {
     if (m_stopped)
         return;
@@ -185,18 +296,50 @@ void MediaStreamTrack::sourceChangedState()
     m_readyState = m_source->readyState();
 
     if (m_readyState >= MediaStreamSource::Live && oldReadyState == MediaStreamSource::New)
-        dispatchEvent(Event::create(eventNames().startedEvent, false, false));
+        scheduleEventDispatch(Event::create(eventNames().startedEvent, false, false));
     if (m_readyState == MediaStreamSource::Ended && oldReadyState != MediaStreamSource::Ended)
-        dispatchEvent(Event::create(eventNames().endedEvent, false, false));
+        scheduleEventDispatch(Event::create(eventNames().endedEvent, false, false));
+}
+    
+void MediaStreamTrack::sourceMutedChanged()
+{
+    if (m_stopped)
+        return;
 
-    if (m_muted == m_source->muted())
+    bool muted = m_source->muted();
+    if (m_muted == muted)
         return;
 
-    m_muted = m_source->muted();
+    m_muted = muted;
     if (m_muted)
-        dispatchEvent(Event::create(eventNames().muteEvent, false, false));
+        scheduleEventDispatch(Event::create(eventNames().muteEvent, false, false));
     else
-        dispatchEvent(Event::create(eventNames().unmuteEvent, false, false));
+        scheduleEventDispatch(Event::create(eventNames().unmuteEvent, false, false));
+
+    configureTrackRendering();
+}
+
+void MediaStreamTrack::sourceEnabledChanged()
+{
+    if (m_stopped)
+        return;
+    
+    // media from the source only flows when a MediaStreamTrack object is both unmuted and enabled
+    configureTrackRendering();
+}
+
+void MediaStreamTrack::configureTrackRendering()
+{
+    if (m_stopped)
+        return;
+
+    // 4.3.1
+    // ... media from the source only flows when a MediaStreamTrack object is both unmuted and enabled
+}
+
+bool MediaStreamTrack::stopped()
+{
+    return m_stopped;
 }
 
 void MediaStreamTrack::trackDidEnd()
@@ -211,7 +354,37 @@ void MediaStreamTrack::trackDidEnd()
 
 void MediaStreamTrack::stop()
 {
-    m_stopped = true;
+    stopProducingData();
+}
+
+void MediaStreamTrack::scheduleEventDispatch(PassRefPtr<Event> event)
+{
+    {
+        MutexLocker locker(m_mutex);
+        m_scheduledEvents.append(event);
+        if (m_eventDispatchScheduled)
+            return;
+        m_eventDispatchScheduled = true;
+    }
+
+    callOnMainThread(bind(&MediaStreamTrack::dispatchQueuedEvents, this));
+}
+
+void MediaStreamTrack::dispatchQueuedEvents()
+{
+    Vector<RefPtr<Event>> events;
+    {
+        MutexLocker locker(m_mutex);
+        m_eventDispatchScheduled = false;
+        events.swap(m_scheduledEvents);
+    }
+    if (!scriptExecutionContext())
+        return;
+
+    for (auto it = events.begin(); it != events.end(); ++it)
+        dispatchEvent((*it).release());
+
+    events.clear();
 }
 
 } // namespace WebCore
index 895a94f..b5dabd0 100644 (file)
 namespace WebCore {
 
 class Dictionary;
-class MediaConstraints;
+class MediaConstraintsImpl;
+class MediaSourceStates;
 class MediaStreamTrackSourcesCallback;
+class MediaStreamCapabilities;
+class MediaTrackConstraints;
 
 class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public MediaStreamSource::Observer {
 public:
@@ -54,17 +57,31 @@ public:
 
     bool enabled() const;
     void setEnabled(bool);
-    
+
+    bool muted() const;
+    bool readonly() const;
+    bool remote() const;
+
     const AtomicString& readyState() const;
 
     static void getSources(ScriptExecutionContext*, PassRefPtr<MediaStreamTrackSourcesCallback>, ExceptionCode&);
 
-    MediaStreamSource* source() const { return m_source.get(); }
-    void setSource(MediaStreamSource*);
+    RefPtr<MediaTrackConstraints> constraints() const;
+    RefPtr<MediaSourceStates> states() const;
+    RefPtr<MediaStreamCapabilities> capabilities() const;
+    void applyConstraints(const Dictionary&);
+
+    RefPtr<MediaStreamTrack> clone();
+    void stopProducingData();
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(mute);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(started);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(overconstrained);
+
+    MediaStreamSource* source() const { return m_source.get(); }
+    void setSource(MediaStreamSource*);
 
     bool ended() const;
 
@@ -72,33 +89,45 @@ public:
     virtual EventTargetInterface eventTargetInterface() const OVERRIDE FINAL { return MediaStreamTrackEventTargetInterfaceType; }
     virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE FINAL { return ActiveDOMObject::scriptExecutionContext(); }
 
-    // ActiveDOMObject
-    virtual void stop() OVERRIDE FINAL;
-
     using RefCounted<MediaStreamTrack>::ref;
     using RefCounted<MediaStreamTrack>::deref;
 
 protected:
+    explicit MediaStreamTrack(MediaStreamTrack*);
     MediaStreamTrack(ScriptExecutionContext*, MediaStreamSource*, const Dictionary*);
 
 private:
+
+    void configureTrackRendering();
     void trackDidEnd();
+    void scheduleEventDispatch(PassRefPtr<Event>);
+    void dispatchQueuedEvents();
+
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE FINAL;
 
     // EventTarget
     virtual void refEventTarget() OVERRIDE FINAL { ref(); }
     virtual void derefEventTarget() OVERRIDE FINAL { deref(); }
 
     // MediaStreamSourceObserver
-    virtual void sourceChangedState() OVERRIDE FINAL;
+    virtual void sourceStateChanged() OVERRIDE FINAL;
+    virtual void sourceMutedChanged() OVERRIDE FINAL;
+    virtual void sourceEnabledChanged() OVERRIDE FINAL;
+    virtual bool stopped() OVERRIDE FINAL;
+
+    Vector<RefPtr<Event>> m_scheduledEvents;
 
     RefPtr<MediaStreamSource> m_source;
-    RefPtr<MediaConstraints> m_constraints;
+    RefPtr<MediaConstraintsImpl> m_constraints;
     MediaStreamSource::ReadyState m_readyState;
     mutable String m_id;
+    Mutex m_mutex;
 
     bool m_stopped;
     bool m_enabled;
     bool m_muted;
+    bool m_eventDispatchScheduled;
 };
 
 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector;
index 83ac104..f2f5345 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * 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
@@ -22,6 +23,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+enum MediaStreamTrackState { "new", "live", "ended" };
+
 [
     Conditional=MEDIA_STREAM,
     EventTarget,
     readonly attribute DOMString id;
     readonly attribute DOMString label;
              attribute boolean enabled;
-
-    readonly attribute DOMString readyState;
-
+    readonly attribute boolean muted;
     attribute EventListener onmute;
     attribute EventListener onunmute;
+    readonly attribute boolean _readonly;
+    readonly attribute boolean remote;
+    readonly attribute MediaStreamTrackState readyState;
+    attribute EventListener onstarted;
     attribute EventListener onended;
 
     [CallWith=ScriptExecutionContext, RaisesException] static void getSources(MediaStreamTrackSourcesCallback callback);
 
+    MediaTrackConstraints constraints();
+
+    MediaSourceStates states();
+
+    MediaStreamCapabilities capabilities(); // returns either AllVideoCapabilities or AllAudioCapabilities
+
+    void applyConstraints(Dictionary constraints);
+
+    attribute EventListener onoverconstrained;
+    MediaStreamTrack clone();
+    [ImplementedAs=stopProducingData] void stop();
+
     // EventTarget interface
     void addEventListener(DOMString type,
                           EventListener listener,
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraint.cpp b/Source/WebCore/Modules/mediastream/MediaTrackConstraint.cpp
new file mode 100644 (file)
index 0000000..453fceb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 COMPUTER, 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 "MediaTrackConstraint.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+RefPtr<MediaTrackConstraint> MediaTrackConstraint::create(const Dictionary& constraint)
+{
+    return adoptRef(new MediaTrackConstraint(constraint));
+}
+
+MediaTrackConstraint::MediaTrackConstraint(const Dictionary& constraint)
+    : m_constraint(constraint)
+{
+}
+
+MediaTrackConstraint::~MediaTrackConstraint()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraint.h b/Source/WebCore/Modules/mediastream/MediaTrackConstraint.h
new file mode 100644 (file)
index 0000000..fd29481
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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 COMPUTER, 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 MediaTrackConstraint_h
+#define MediaTrackConstraint_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "Dictionary.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class ScriptValue;
+
+class MediaTrackConstraint : public RefCounted<MediaTrackConstraint>, public ScriptWrappable {
+public:
+    static RefPtr<MediaTrackConstraint> create(const Dictionary&);
+
+    virtual ~MediaTrackConstraint();
+
+    const Dictionary& constraint() const { return m_constraint; }
+
+private:
+    explicit MediaTrackConstraint(const Dictionary&);
+    
+    const Dictionary& m_constraint;
+};
+
+} // namespace WebCore
+
+#endif // MediaTrackConstraint_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraint.idl b/Source/WebCore/Modules/mediastream/MediaTrackConstraint.idl
new file mode 100644 (file)
index 0000000..54af7b9
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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,
+] interface MediaTrackConstraint {
+};
+
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.cpp b/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.cpp
new file mode 100644 (file)
index 0000000..a5aec90
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 COMPUTER, 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 "MediaTrackConstraintSet.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+RefPtr<MediaTrackConstraintSet> MediaTrackConstraintSet::create(const Dictionary& constraints)
+{
+    return adoptRef(new MediaTrackConstraintSet(constraints));
+}
+
+MediaTrackConstraintSet::MediaTrackConstraintSet(const Dictionary& constraints)
+    : m_constraints(constraints)
+{
+}
+
+MediaTrackConstraintSet::~MediaTrackConstraintSet()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.h b/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.h
new file mode 100644 (file)
index 0000000..b6978ae
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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 COMPUTER, 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 MediaTrackConstraintSet_h
+#define MediaTrackConstraintSet_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "Dictionary.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class MediaTrackConstraintSet : public RefCounted<MediaTrackConstraintSet>, public ScriptWrappable {
+public:
+    static RefPtr<MediaTrackConstraintSet> create(const Dictionary&);
+
+    virtual ~MediaTrackConstraintSet();
+
+    const Dictionary& constraints() const { return m_constraints; }
+
+private:
+    explicit MediaTrackConstraintSet(const Dictionary&);
+    
+    const Dictionary& m_constraints;
+};
+
+} // namespace WebCore
+
+#endif // MediaTrackConstraintSet_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.idl b/Source/WebCore/Modules/mediastream/MediaTrackConstraintSet.idl
new file mode 100644 (file)
index 0000000..82754c8
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 GOOGLE 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 GOOGLE 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,
+] interface MediaTrackConstraintSet {
+    // FIXME: Not implemented.
+    // https://bugs.webkit.org/show_bug.cgi?id=121954
+};
+
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp
new file mode 100644 (file)
index 0000000..77b1054
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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 COMPUTER, 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 "MediaTrackConstraints.h"
+
+#include "MediaTrackConstraint.h"
+#include "MediaTrackConstraintSet.h"
+#include "NotImplemented.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+RefPtr<MediaTrackConstraints> MediaTrackConstraints::create(PassRefPtr<MediaConstraintsImpl> constraints)
+{
+    return adoptRef(new MediaTrackConstraints(constraints));
+}
+
+MediaTrackConstraints::MediaTrackConstraints(PassRefPtr<MediaConstraintsImpl> constraints)
+    : m_constraints(constraints)
+{
+}
+
+Vector<PassRefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional(bool) const
+{
+    // https://bugs.webkit.org/show_bug.cgi?id=121954
+    notImplemented();
+    return Vector<PassRefPtr<MediaTrackConstraint>>();
+}
+
+RefPtr<MediaTrackConstraintSet> MediaTrackConstraints::mandatory(bool) const
+{
+    // https://bugs.webkit.org/show_bug.cgi?id=121954
+    notImplemented();
+    return nullptr;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h
new file mode 100644 (file)
index 0000000..95a8cca
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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 COMPUTER, 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 MediaTrackConstraints_h
+#define MediaTrackConstraints_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaConstraintsImpl.h"
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class MediaTrackConstraint;
+class MediaTrackConstraintSet;
+
+class MediaTrackConstraints : public RefCounted<MediaTrackConstraints>, public ScriptWrappable {
+public:
+    virtual ~MediaTrackConstraints() { }
+
+    static RefPtr<MediaTrackConstraints> create(PassRefPtr<MediaConstraintsImpl>);
+
+    Vector<PassRefPtr<MediaTrackConstraint>> optional(bool) const;
+    RefPtr<MediaTrackConstraintSet> mandatory(bool) const;
+
+private:
+    explicit MediaTrackConstraints(PassRefPtr<MediaConstraintsImpl>);
+    
+    RefPtr<MediaConstraintsImpl> m_constraints;
+};
+
+} // namespace WebCore
+
+#endif // MediaTrackConstraints_h
+
+#endif
diff --git a/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl b/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl
new file mode 100644 (file)
index 0000000..aab80d0
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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,
+] interface MediaTrackConstraints {
+    readonly attribute MediaTrackConstraintSet? mandatory;
+    readonly attribute MediaTrackConstraint[]? optional;
+};
+
index d880af3..dc0b520 100644 (file)
@@ -173,7 +173,6 @@ void UserMediaRequest::callSuccessHandler(PassRefPtr<MediaStreamDescriptor> stre
     for (MediaStreamTrackVector::iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
         (*iter)->source()->setConstraints(m_videoConstraints);
 
-    MediaStreamCenter::shared().didCreateMediaStream(streamDescriptor.get());
     m_successCallback->handleEvent(stream.get());
 }
 
index 7014190..b6af8e1 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<VideoStreamTrack> VideoStreamTrack::create(ScriptExecutionContext* context, const Dictionary& videoConstraints)
+RefPtr<VideoStreamTrack> VideoStreamTrack::create(ScriptExecutionContext* context, const Dictionary& videoConstraints)
 {
     RefPtr<VideoStreamTrack> track = adoptRef(new VideoStreamTrack(context, 0, &videoConstraints));
     return track.release();
 }
 
-PassRefPtr<VideoStreamTrack> VideoStreamTrack::create(ScriptExecutionContext* context, MediaStreamSource* source)
+RefPtr<VideoStreamTrack> VideoStreamTrack::create(ScriptExecutionContext* context, MediaStreamSource* source)
 {
     RefPtr<VideoStreamTrack> track = adoptRef(new VideoStreamTrack(context, source, 0));
     return track.release();
 }
 
+RefPtr<VideoStreamTrack> VideoStreamTrack::create(MediaStreamTrack* track)
+{
+    return adoptRef(new VideoStreamTrack(track));
+}
+
 VideoStreamTrack::VideoStreamTrack(ScriptExecutionContext* context, MediaStreamSource* source, const Dictionary* videoConstraints)
     : MediaStreamTrack(context, source, videoConstraints)
 {
 }
 
+VideoStreamTrack::VideoStreamTrack(MediaStreamTrack* track)
+    : MediaStreamTrack(track)
+{
+}
+
 const AtomicString& VideoStreamTrack::kind() const
 {
     static NeverDestroyed<AtomicString> videoKind("video", AtomicString::ConstructFromLiteral);
index 5137e81..2034763 100644 (file)
@@ -29,8 +29,8 @@
 #if ENABLE(MEDIA_STREAM)
 
 #include "MediaStreamTrack.h"
-#include <wtf/Vector.h>
 #include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
@@ -39,8 +39,9 @@ class ScriptExecutionContext;
 
 class VideoStreamTrack FINAL : public MediaStreamTrack {
 public:
-    static PassRefPtr<VideoStreamTrack> create(ScriptExecutionContext*, const Dictionary&);
-    static PassRefPtr<VideoStreamTrack> create(ScriptExecutionContext*, MediaStreamSource*);
+    static RefPtr<VideoStreamTrack> create(ScriptExecutionContext*, const Dictionary&);
+    static RefPtr<VideoStreamTrack> create(ScriptExecutionContext*, MediaStreamSource*);
+    static RefPtr<VideoStreamTrack> create(MediaStreamTrack*);
 
     virtual ~VideoStreamTrack() { }
 
@@ -48,6 +49,7 @@ public:
 
 private:
     VideoStreamTrack(ScriptExecutionContext*, MediaStreamSource*, const Dictionary*);
+    explicit VideoStreamTrack(MediaStreamTrack*);
 };
 
 } // namespace WebCore
index df06860..b3034d3 100644 (file)
@@ -63,6 +63,7 @@
 #if ENABLE(MEDIA_STREAM)
 #include "MediaStream.h"
 #include "MediaStreamAudioDestinationNode.h"
+#include "MediaStreamAudioSource.h"
 #include "MediaStreamAudioSourceNode.h"
 #endif
 
@@ -420,12 +421,14 @@ PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med
     // FIXME: get a provider for non-local MediaStreams (like from a remote peer).
     for (size_t i = 0; i < audioTracks.size(); ++i) {
         RefPtr<MediaStreamTrack> localAudio = audioTracks[i];
-        MediaStreamSource* source = localAudio->source();
-        if (!source->deviceId().isEmpty()) {
-            destination()->enableInput(source->deviceId());
-            provider = destination()->localAudioInputProvider();
-            break;
-        }
+        if (!localAudio->source()->isAudioStreamSource())
+            continue;
+
+        MediaStreamAudioSource* source = static_cast<MediaStreamAudioSource*>(localAudio->source());
+        ASSERT(!source->deviceId().isEmpty());
+        destination()->enableInput(source->deviceId());
+        provider = destination()->localAudioInputProvider();
+        break;
     }
 
     RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create(this, mediaStream, provider);
@@ -733,7 +736,7 @@ void AudioContext::addDeferredFinishDeref(AudioNode* node)
 void AudioContext::handlePreRenderTasks()
 {
     ASSERT(isAudioThread());
+
     // At the beginning of every render quantum, try to update the internal rendering graph state (from main thread changes).
     // It's OK if the tryLock() fails, we'll just take slightly longer to pick up the changes.
     bool mustReleaseLock;
@@ -752,8 +755,8 @@ void AudioContext::handlePreRenderTasks()
 void AudioContext::handlePostRenderTasks()
 {
     ASSERT(isAudioThread());
-    // Must use a tryLock() here too.  Don't worry, the lock will very rarely be contended and this method is called frequently.
+
+    // Must use a tryLock() here too. Don't worry, the lock will very rarely be contended and this method is called frequently.
     // The worst that can happen is that there will be some nodes which will take slightly longer than usual to be deleted or removed
     // from the render graph (in which case they'll render silence).
     bool mustReleaseLock;
index 80485fd..a64da53 100644 (file)
@@ -31,9 +31,8 @@
 #include "AudioContext.h"
 #include "AudioNodeInput.h"
 #include "MediaStream.h"
-#include "MediaStreamCenter.h"
+#include "MediaStreamAudioSource.h"
 #include "RTCPeerConnectionHandler.h"
-#include "UUID.h"
 #include <wtf/Locker.h>
 
 namespace WebCore {
@@ -49,12 +48,10 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* c
 {
     setNodeType(NodeTypeMediaStreamAudioDestination);
 
-    m_source = MediaStreamSource::create(ASCIILiteral("WebAudio-") + createCanonicalUUIDString(), MediaStreamSource::Audio, "MediaStreamAudioDestinationNode", MediaStreamSource::Live, true);
+    m_source = MediaStreamAudioSource::create();
     MediaStreamSourceVector audioSources;
     audioSources.append(m_source);
-    MediaStreamSourceVector videoSources;
-    m_stream = MediaStream::create(context->scriptExecutionContext(), MediaStreamDescriptor::create(audioSources, videoSources));
-    MediaStreamCenter::shared().didCreateMediaStream(m_stream->descriptor());
+    m_stream = MediaStream::create(context->scriptExecutionContext(), MediaStreamDescriptor::create(audioSources, MediaStreamSourceVector()));
 
     m_source->setAudioFormat(numberOfChannels, context->sampleRate());
 
index 17bbd82..a8f5891 100644 (file)
@@ -36,6 +36,7 @@
 namespace WebCore {
 
 class AudioContext;
+class MediaStreamAudioSource;
 
 class MediaStreamAudioDestinationNode : public AudioBasicInspectorNode {
 public:
@@ -61,7 +62,7 @@ private:
     virtual bool propagatesSilence() const OVERRIDE { return false; }
 
     RefPtr<MediaStream> m_stream;
-    RefPtr<MediaStreamSource> m_source;
+    RefPtr<MediaStreamAudioSource> m_source;
     RefPtr<AudioBus> m_mixBus;
 };
 
diff --git a/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp b/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp
new file mode 100644 (file)
index 0000000..ea4f27c
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "MediaStreamAudioSource.h"
+
+#include "NotImplemented.h"
+#include "UUID.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+RefPtr<MediaStreamAudioSource> MediaStreamAudioSource::create()
+{
+    return adoptRef(new MediaStreamAudioSource());
+}
+
+MediaStreamAudioSource::MediaStreamAudioSource()
+    : MediaStreamSource(ASCIILiteral("WebAudio-") + createCanonicalUUIDString(), MediaStreamSource::Audio, "MediaStreamAudioDestinationNode")
+{
+}
+
+RefPtr<MediaStreamSourceCapabilities> MediaStreamAudioSource::capabilities() const
+{
+    // FIXME: implement this.
+    // https://bugs.webkit.org/show_bug.cgi?id=122430
+    notImplemented();
+    return 0;
+}
+
+const MediaStreamSourceStates& MediaStreamAudioSource::states()
+{
+    // FIXME: implement this.
+    // https://bugs.webkit.org/show_bug.cgi?id=122430
+    notImplemented();
+    return m_currentStates;
+    
+}
+
+void MediaStreamAudioSource::addAudioConsumer(PassRefPtr<AudioDestinationConsumer> consumer)
+{
+    MutexLocker locker(m_audioConsumersLock);
+    m_audioConsumers.append(consumer);
+}
+
+bool MediaStreamAudioSource::removeAudioConsumer(AudioDestinationConsumer* consumer)
+{
+    MutexLocker locker(m_audioConsumersLock);
+    size_t pos = m_audioConsumers.find(consumer);
+    if (pos != notFound) {
+        m_audioConsumers.remove(pos);
+        return true;
+    }
+    return false;
+}
+
+void MediaStreamAudioSource::setAudioFormat(size_t numberOfChannels, float sampleRate)
+{
+    MutexLocker locker(m_audioConsumersLock);
+    for (Vector<RefPtr<AudioDestinationConsumer> >::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)
+        (*it)->setFormat(numberOfChannels, sampleRate);
+}
+
+void MediaStreamAudioSource::consumeAudio(AudioBus* bus, size_t numberOfFrames)
+{
+    MutexLocker locker(m_audioConsumersLock);
+    for (Vector<RefPtr<AudioDestinationConsumer> >::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)
+        (*it)->consumeAudio(bus, numberOfFrames);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h b/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h
new file mode 100644 (file)
index 0000000..64101d4
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 MediaStreamAudioSource_h
+#define MediaStreamAudioSource_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "AudioDestinationConsumer.h"
+#include "MediaStreamSource.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class AudioBus;
+class MediaStreamSourceCapabilities;
+
+class MediaStreamAudioSource : public MediaStreamSource {
+public:
+    static RefPtr<MediaStreamAudioSource> create();
+
+    ~MediaStreamAudioSource() { }
+
+    virtual bool isAudioStreamSource() const { return true; }
+    virtual bool useIDForTrackID() const { return true; }
+
+    virtual RefPtr<MediaStreamSourceCapabilities> capabilities() const;
+    virtual const MediaStreamSourceStates& states();
+    
+    const String& deviceId() const { return m_deviceId; }
+    void setDeviceId(const String& deviceId) { m_deviceId = deviceId; }
+
+    void setAudioFormat(size_t numberOfChannels, float sampleRate);
+    void consumeAudio(AudioBus*, size_t numberOfFrames);
+
+    void addAudioConsumer(PassRefPtr<AudioDestinationConsumer>);
+    bool removeAudioConsumer(AudioDestinationConsumer*);
+    const Vector<RefPtr<AudioDestinationConsumer>>& audioConsumers() const { return m_audioConsumers; }
+
+private:
+    MediaStreamAudioSource();
+
+    String m_deviceId;
+    Mutex m_audioConsumersLock;
+    Vector<RefPtr<AudioDestinationConsumer>> m_audioConsumers;
+    MediaStreamSourceStates m_currentStates;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamAudioSource_h
index 5ba7eb6..f1b7220 100644 (file)
                070334D71459FFD5008D8D45 /* TrackBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 070334D61459FFD5008D8D45 /* TrackBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                070334D9145A006F008D8D45 /* TrackBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070334D8145A006F008D8D45 /* TrackBase.cpp */; };
                070334E9145A1F36008D8D45 /* JSTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */; };
+               070584FD17F9D6DF005F2BCB /* MediaStreamSourceCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 070584FB17F9D6DF005F2BCB /* MediaStreamSourceCapabilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               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 */; };
+               0705852917FDE02C005F2BCB /* MediaTrackConstraintSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705852617FDE02B005F2BCB /* MediaTrackConstraintSet.h */; };
+               0705853117FDE6D9005F2BCB /* JSMediaTrackConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705852B17FDE6D9005F2BCB /* JSMediaTrackConstraint.cpp */; };
+               0705853217FDE6D9005F2BCB /* JSMediaTrackConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705852C17FDE6D9005F2BCB /* JSMediaTrackConstraint.h */; };
+               0705853317FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705852D17FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp */; };
+               0705853417FDE6D9005F2BCB /* JSMediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705852E17FDE6D9005F2BCB /* JSMediaTrackConstraints.h */; };
+               0705853517FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705852F17FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp */; };
+               0705853617FDE6D9005F2BCB /* JSMediaTrackConstraintSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0705853017FDE6D9005F2BCB /* JSMediaTrackConstraintSet.h */; };
+               0705853817FE044F005F2BCB /* MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705853717FE044F005F2BCB /* MediaTrackConstraintSet.cpp */; };
+               0705853A17FE0770005F2BCB /* MediaTrackConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0705853917FE0770005F2BCB /* MediaTrackConstraint.cpp */; };
                0707568B142262D600414161 /* HTMLTrackElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07075688142262D600414161 /* HTMLTrackElement.cpp */; };
                0707568C142262D600414161 /* HTMLTrackElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 07075689142262D600414161 /* HTMLTrackElement.h */; };
                070756941422668D00414161 /* JSTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0707568E1422668C00414161 /* JSTextTrack.cpp */; };
                0735EE6A0F40C5E4004A2604 /* MediaPlayerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07367DDF172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07367DDD172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.h */; };
                07367DE0172CA68200D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07367DDE172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.mm */; };
+               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 /* JSNavigatorMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 073BE33E17D17E01002BD431 /* JSNavigatorMediaStream.cpp */; };
                073BE34117D17E01002BD431 /* JSNavigatorMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 073BE33F17D17E01002BD431 /* JSNavigatorMediaStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
                073BE34817D17E7A002BD431 /* JSNavigatorUserMediaError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 073BE34217D17E7A002BD431 /* JSNavigatorUserMediaError.cpp */; };
                076970861463AD8700F502CF /* TextTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076970841463AD8700F502CF /* TextTrackList.cpp */; };
                076970871463AD8700F502CF /* TextTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = 076970851463AD8700F502CF /* TextTrackList.h */; };
                076F0D0E12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 076F0D0A12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h */; };
+               0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */; };
+               0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 0783228318013ED800999E0C /* MediaStreamAudioSource.h */; };
                07846342145B151A00A58DF1 /* JSTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07846340145B151A00A58DF1 /* JSTrackEvent.cpp */; };
                07846343145B151A00A58DF1 /* JSTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846341145B151A00A58DF1 /* JSTrackEvent.h */; };
                07846385145B1B8E00A58DF1 /* JSTrackCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */; };
                07C59B6017F4B208000FBCBB /* JSVideoStreamTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B5C17F4B208000FBCBB /* JSVideoStreamTrack.h */; };
                07C59B6317F4D1BF000FBCBB /* MockMediaStreamCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6117F4CF87000FBCBB /* MockMediaStreamCenter.cpp */; };
                07C59B6417F4D1C4000FBCBB /* MockMediaStreamCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B6217F4CF87000FBCBB /* MockMediaStreamCenter.h */; };
+               07C59B6817F784BA000FBCBB /* MediaSourceStates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6517F784BA000FBCBB /* MediaSourceStates.cpp */; };
+               07C59B6917F784BA000FBCBB /* MediaSourceStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B6617F784BA000FBCBB /* MediaSourceStates.h */; };
+               07C59B6E17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6D17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp */; };
+               07C59B7117F79C7C000FBCBB /* JSMediaSourceStates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07C59B6F17F79C7C000FBCBB /* JSMediaSourceStates.cpp */; };
+               07C59B7217F79C7C000FBCBB /* JSMediaSourceStates.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B7017F79C7C000FBCBB /* JSMediaSourceStates.h */; };
+               07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C59B7417F7D09D000FBCBB /* CapabilityRange.h */; };
                07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07DC5FD417D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */; };
                07E116B11489C9A100EC5ACE /* JSTextTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */; };
                070334D61459FFD5008D8D45 /* TrackBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackBase.h; sourceTree = "<group>"; };
                070334D8145A006F008D8D45 /* TrackBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackBase.cpp; sourceTree = "<group>"; };
                070334E8145A1F35008D8D45 /* JSTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackCustom.cpp; sourceTree = "<group>"; };
+               070584FB17F9D6DF005F2BCB /* MediaStreamSourceCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamSourceCapabilities.h; 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>"; };
+               0705851F17FDC140005F2BCB /* MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraints.cpp; sourceTree = "<group>"; };
+               0705852017FDC140005F2BCB /* MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackConstraints.h; sourceTree = "<group>"; };
+               0705852617FDE02B005F2BCB /* MediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackConstraintSet.h; sourceTree = "<group>"; };
+               0705852717FDE02B005F2BCB /* MediaTrackConstraintSet.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackConstraintSet.idl; sourceTree = "<group>"; };
+               0705852B17FDE6D9005F2BCB /* JSMediaTrackConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaTrackConstraint.cpp; sourceTree = "<group>"; };
+               0705852C17FDE6D9005F2BCB /* JSMediaTrackConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraint.h; sourceTree = "<group>"; };
+               0705852D17FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaTrackConstraints.cpp; sourceTree = "<group>"; };
+               0705852E17FDE6D9005F2BCB /* JSMediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraints.h; sourceTree = "<group>"; };
+               0705852F17FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaTrackConstraintSet.cpp; sourceTree = "<group>"; };
+               0705853017FDE6D9005F2BCB /* JSMediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraintSet.h; sourceTree = "<group>"; };
+               0705853717FE044F005F2BCB /* MediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraintSet.cpp; sourceTree = "<group>"; };
+               0705853917FE0770005F2BCB /* MediaTrackConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraint.cpp; sourceTree = "<group>"; };
                07075688142262D600414161 /* HTMLTrackElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTrackElement.cpp; sourceTree = "<group>"; };
                07075689142262D600414161 /* HTMLTrackElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTrackElement.h; sourceTree = "<group>"; };
                0707568A142262D600414161 /* HTMLTrackElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTrackElement.idl; sourceTree = "<group>"; };
                0735EE690F40C5E4004A2604 /* MediaPlayerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerProxy.h; sourceTree = "<group>"; };
                07367DDD172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InbandTextTrackPrivateLegacyAVFObjC.h; path = objc/InbandTextTrackPrivateLegacyAVFObjC.h; sourceTree = "<group>"; };
                07367DDE172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InbandTextTrackPrivateLegacyAVFObjC.mm; path = objc/InbandTextTrackPrivateLegacyAVFObjC.mm; 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 /* JSNavigatorMediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorMediaStream.cpp; sourceTree = "<group>"; };
                073BE33F17D17E01002BD431 /* JSNavigatorMediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorMediaStream.h; sourceTree = "<group>"; };
                073BE34217D17E7A002BD431 /* JSNavigatorUserMediaError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorUserMediaError.cpp; sourceTree = "<group>"; };
                076970851463AD8700F502CF /* TextTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackList.h; sourceTree = "<group>"; };
                076F0D0912B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaPlayerPrivateAVFoundation.cpp; sourceTree = "<group>"; };
                076F0D0A12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerPrivateAVFoundation.h; sourceTree = "<group>"; };
+               0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamAudioSource.cpp; sourceTree = "<group>"; };
+               0783228318013ED800999E0C /* MediaStreamAudioSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamAudioSource.h; sourceTree = "<group>"; };
                07846340145B151A00A58DF1 /* JSTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackEvent.cpp; sourceTree = "<group>"; };
                07846341145B151A00A58DF1 /* JSTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTrackEvent.h; sourceTree = "<group>"; };
                07846384145B1B8E00A58DF1 /* JSTrackCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTrackCustom.h; sourceTree = "<group>"; };
                07C59B5C17F4B208000FBCBB /* JSVideoStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVideoStreamTrack.h; sourceTree = "<group>"; };
                07C59B6117F4CF87000FBCBB /* MockMediaStreamCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MockMediaStreamCenter.cpp; path = mock/MockMediaStreamCenter.cpp; sourceTree = "<group>"; };
                07C59B6217F4CF87000FBCBB /* MockMediaStreamCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockMediaStreamCenter.h; path = mock/MockMediaStreamCenter.h; sourceTree = "<group>"; };
+               07C59B6517F784BA000FBCBB /* MediaSourceStates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSourceStates.cpp; sourceTree = "<group>"; };
+               07C59B6617F784BA000FBCBB /* MediaSourceStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourceStates.h; sourceTree = "<group>"; };
+               07C59B6717F784BA000FBCBB /* MediaSourceStates.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaSourceStates.idl; sourceTree = "<group>"; };
+               07C59B6D17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSourceStatesCustom.cpp; sourceTree = "<group>"; };
+               07C59B6F17F79C7C000FBCBB /* JSMediaSourceStates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSourceStates.cpp; sourceTree = "<group>"; };
+               07C59B7017F79C7C000FBCBB /* JSMediaSourceStates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSourceStates.h; 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>"; };
                07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
                07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCStatsResponseCustom.cpp; sourceTree = "<group>"; };
                07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
                07221B4617CEC32700848E51 /* mediastream */ = {
                        isa = PBXGroup;
                        children = (
+                               0705853917FE0770005F2BCB /* MediaTrackConstraint.cpp */,
+                               0705853717FE044F005F2BCB /* MediaTrackConstraintSet.cpp */,
+                               0705852617FDE02B005F2BCB /* MediaTrackConstraintSet.h */,
+                               0705852717FDE02B005F2BCB /* MediaTrackConstraintSet.idl */,
+                               0705851D17FDC140005F2BCB /* MediaTrackConstraint.h */,
+                               0705851E17FDC140005F2BCB /* MediaTrackConstraint.idl */,
+                               0705851F17FDC140005F2BCB /* MediaTrackConstraints.cpp */,
+                               0705852017FDC140005F2BCB /* MediaTrackConstraints.h */,
+                               0705851C17FDB23C005F2BCB /* MediaTrackConstraints.idl */,
+                               0705850517FA4689005F2BCB /* AllAudioCapabilities.h */,
+                               0705850617FA4689005F2BCB /* AllAudioCapabilities.idl */,
+                               070584FE17F9F05E005F2BCB /* CapabilityRange.cpp */,
+                               073AB4B017F8BACA006E0D6F /* AllVideoCapabilities.h */,
+                               07C59B7317F7D09D000FBCBB /* AllVideoCapabilities.idl */,
+                               07C59B7417F7D09D000FBCBB /* CapabilityRange.h */,
+                               07C59B7517F7D09D000FBCBB /* CapabilityRange.idl */,
+                               07C59B6517F784BA000FBCBB /* MediaSourceStates.cpp */,
+                               07C59B6617F784BA000FBCBB /* MediaSourceStates.h */,
+                               07C59B6717F784BA000FBCBB /* MediaSourceStates.idl */,
                                07C59B4D17F4AC15000FBCBB /* AudioStreamTrack.cpp */,
                                07C59B4E17F4AC15000FBCBB /* AudioStreamTrack.h */,
                                07C59B4F17F4AC15000FBCBB /* AudioStreamTrack.idl */,
                                07C59B5017F4AC15000FBCBB /* VideoStreamTrack.cpp */,
                                07C59B5117F4AC15000FBCBB /* VideoStreamTrack.h */,
                                07C59B5217F4AC15000FBCBB /* VideoStreamTrack.idl */,
+                               0705851417FB0E2C005F2BCB /* MediaStreamCapabilities.cpp */,
+                               0705850E17FA6FB1005F2BCB /* MediaStreamCapabilities.idl */,
+                               0705850A17FA4827005F2BCB /* MediaStreamCapabilities.h */,
                                07221B4A17CEC32700848E51 /* MediaConstraintsImpl.cpp */,
                                07221B4B17CEC32700848E51 /* MediaConstraintsImpl.h */,
                                07221B4C17CEC32700848E51 /* MediaStream.cpp */,
                                07221B9D17CF0AD400848E51 /* MediaStreamDescriptor.h */,
                                07221B9E17CF0AD400848E51 /* MediaStreamSource.cpp */,
                                07221B9F17CF0AD400848E51 /* MediaStreamSource.h */,
+                               070584FB17F9D6DF005F2BCB /* MediaStreamSourceCapabilities.h */,
                                076306E217E22A43005A7C4E /* MediaStreamTrackSourcesRequestClient.h */,
                                07221BA117CF0AD400848E51 /* RTCConfiguration.h */,
                                07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */,
                07CFD99317D01405001C4FFC /* MediaStream */ = {
                        isa = PBXGroup;
                        children = (
+                               0705852B17FDE6D9005F2BCB /* JSMediaTrackConstraint.cpp */,
+                               0705852C17FDE6D9005F2BCB /* JSMediaTrackConstraint.h */,
+                               0705852D17FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp */,
+                               0705852E17FDE6D9005F2BCB /* JSMediaTrackConstraints.h */,
+                               0705852F17FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp */,
+                               0705853017FDE6D9005F2BCB /* JSMediaTrackConstraintSet.h */,
+                               0705851017FA7107005F2BCB /* JSMediaStreamCapabilities.cpp */,
+                               0705851117FA7107005F2BCB /* JSMediaStreamCapabilities.h */,
+                               07C59B6F17F79C7C000FBCBB /* JSMediaSourceStates.cpp */,
+                               07C59B7017F79C7C000FBCBB /* JSMediaSourceStates.h */,
                                07C59B5917F4B208000FBCBB /* JSAudioStreamTrack.cpp */,
                                07C59B5A17F4B208000FBCBB /* JSAudioStreamTrack.h */,
                                07C59B5B17F4B208000FBCBB /* JSVideoStreamTrack.cpp */,
                BC4EDEF70C08F414007EDD49 /* Custom */ = {
                        isa = PBXGroup;
                        children = (
+                               0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */,
+                               07C59B6D17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp */,
                                BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
                                FDEAAAEF12B02EE400DCF33B /* JSAudioBufferSourceNodeCustom.cpp */,
                                FDEAAAF012B02EE400DCF33B /* JSAudioContextCustom.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 */,
                FD315FA212B025B100C1A359 /* webaudio */ = {
                        isa = PBXGroup;
                        children = (
+                               0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */,
+                               0783228318013ED800999E0C /* MediaStreamAudioSource.h */,
                                FD315FF312B0267600C1A359 /* AnalyserNode.cpp */,
                                FD315FF412B0267600C1A359 /* AnalyserNode.h */,
                                FD315FF512B0267600C1A359 /* AnalyserNode.idl */,
                                FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */,
                                FDE2D55B159E66EB00DCCCF8 /* AudioIOCallback.h in Headers */,
                                FD31601012B0267600C1A359 /* AudioListener.h in Headers */,
+                               0705852417FDC140005F2BCB /* MediaTrackConstraints.h in Headers */,
                                FD31601312B0267600C1A359 /* AudioNode.h in Headers */,
                                FD31601612B0267600C1A359 /* AudioNodeInput.h in Headers */,
                                FD31601812B0267600C1A359 /* AudioNodeOutput.h in Headers */,
                                BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */,
                                2DF2E9D5166E39750035BEF2 /* ConsoleAPITypes.h in Headers */,
                                41F0618E0F5F069800A07EAC /* ConsoleMessage.h in Headers */,
+                               073AB4B317F8BACA006E0D6F /* AllVideoCapabilities.h in Headers */,
                                BCE5644E137A34D6007D2934 /* ConsoleTypes.h in Headers */,
                                A818721C0977D3C0005826D9 /* ContainerNode.h in Headers */,
                                E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */,
                                A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */,
                                F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */,
                                453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */,
+                               0705850317FA10D0005F2BCB /* JSAllVideoCapabilities.h in Headers */,
                                F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */,
                                F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */,
                                45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */,
                                FD31602E12B0267600C1A359 /* DelayNode.h in Headers */,
                                FD31603112B0267600C1A359 /* DelayProcessor.h in Headers */,
                                1C4C8F660AD8655D009475CE /* DeleteButton.h in Headers */,
+                               0705853217FDE6D9005F2BCB /* JSMediaTrackConstraint.h in Headers */,
                                1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */,
                                93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
                                07C59B6417F4D1C4000FBCBB /* MockMediaStreamCenter.h in Headers */,
                                CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */,
                                14947FFE12F80CD200A0F631 /* DocumentOrderedMap.h in Headers */,
                                BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */,
+                               0705852917FDE02C005F2BCB /* MediaTrackConstraintSet.h in Headers */,
                                4A4F48AA16B0DFC000EDBB29 /* DocumentRuleSets.h in Headers */,
                                AD6E71AD1668899D00320C13 /* DocumentSharedObjectPool.h in Headers */,
                                E47E276516036ED200EE2AFB /* DocumentStyleSheetCollection.h in Headers */,
                                85992EBA0AA5069500AC0785 /* DOMHTMLHeadElement.h in Headers */,
                                85E711AD0AC5D5350053270F /* DOMHTMLHeadElementInternal.h in Headers */,
                                85183B440AA6926100F19FA3 /* DOMHTMLHeadingElement.h in Headers */,
+                               0705853617FDE6D9005F2BCB /* JSMediaTrackConstraintSet.h in Headers */,
                                85E711AE0AC5D5350053270F /* DOMHTMLHeadingElementInternal.h in Headers */,
                                85ECBEF10AA7626900544F0B /* DOMHTMLHRElement.h in Headers */,
                                85E711AF0AC5D5350053270F /* DOMHTMLHRElementInternal.h in Headers */,
                                85CA96EA0A9624E900690CCF /* DOMNotation.h in Headers */,
                                85E711D40AC5D5350053270F /* DOMNotationInternal.h in Headers */,
                                856C8AE40A912649005C687B /* DOMObject.h in Headers */,
+                               0705851317FA7107005F2BCB /* JSMediaStreamCapabilities.h in Headers */,
                                BC53DA601143141A000D817E /* DOMObjectHashTableMap.h in Headers */,
                                85C7F5D00AAFB8D9004014DD /* DOMOverflowEvent.h in Headers */,
                                85989DCF0ACC8BBD00A0BC51 /* DOMOverflowEventInternal.h in Headers */,
                                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */,
                                977B387A122883E900B81FF8 /* HTMLViewSourceParser.h in Headers */,
                                514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */,
+                               073AB4B817F92ECF006E0D6F /* JSCapabilityRange.h in Headers */,
                                514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */,
                                375CD232119D43C800A2A859 /* Hyphenation.h in Headers */,
                                B275356E0B053814002CE64F /* Icon.h in Headers */,
                                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */,
                                F3D4C47912E07663003DA150 /* InspectorDOMDebuggerAgent.h in Headers */,
                                7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */,
+                               0705853417FDE6D9005F2BCB /* JSMediaTrackConstraints.h in Headers */,
                                578DA20E1520EB8C006141C1 /* InspectorFrontend.h in Headers */,
                                227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */,
                                F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */,
                                B2FA3DDB0AB75A6F000E5AC4 /* JSSVGPathSegList.h in Headers */,
                                B2FA3DDD0AB75A6F000E5AC4 /* JSSVGPathSegMovetoAbs.h in Headers */,
                                B2FA3DDF0AB75A6F000E5AC4 /* JSSVGPathSegMovetoRel.h in Headers */,
+                               0705852117FDC140005F2BCB /* MediaTrackConstraint.h in Headers */,
                                B2FA3DE10AB75A6F000E5AC4 /* JSSVGPatternElement.h in Headers */,
                                8542A7950AE5C94100DF58DF /* JSSVGPoint.h in Headers */,
                                B2FA3DE30AB75A6F000E5AC4 /* JSSVGPointList.h in Headers */,
                                439046E212DA25E800AF80A2 /* RenderMathMLRoot.h in Headers */,
                                439046E412DA25E800AF80A2 /* RenderMathMLRow.h in Headers */,
                                439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */,
+                               0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
                                439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */,
                                439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */,
                                E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */,
                                A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */,
                                BCA846D70DC67A350026C309 /* RenderReplica.h in Headers */,
                                1479FAEE109AE37500DED655 /* RenderRuby.h in Headers */,
+                               0705850817FA4689005F2BCB /* AllAudioCapabilities.h in Headers */,
                                1479FAF0109AE37500DED655 /* RenderRubyBase.h in Headers */,
                                1479FAF2109AE37500DED655 /* RenderRubyRun.h in Headers */,
                                1479FAF4109AE37500DED655 /* RenderRubyText.h in Headers */,
                                973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */,
                                E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */,
                                D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */,
+                               07C59B7617F7D0DB000FBCBB /* CapabilityRange.h in Headers */,
                                8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */,
                                7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */,
                                514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */,
                                078E093817D16B2C00420AA1 /* MediaStreamSource.h in Headers */,
                                B22279B10D00BF220071B782 /* SVGDescElement.h in Headers */,
                                B5B7A17117C10AC000E4AA0A /* ElementData.h in Headers */,
+                               0705850B17FA4827005F2BCB /* MediaStreamCapabilities.h in Headers */,
                                B22279B40D00BF220071B782 /* SVGDocument.h in Headers */,
                                B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */,
                                B22279B70D00BF220071B782 /* SVGElement.h in Headers */,
                                7134496E146941B300720312 /* SVGLengthContext.h in Headers */,
                                B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */,
                                B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
+                               07C59B6917F784BA000FBCBB /* MediaSourceStates.h in Headers */,
                                B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
                                0810764412828556007C63BA /* SVGListProperty.h in Headers */,
                                088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */,
                                E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */,
                                49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */,
                                070334D71459FFD5008D8D45 /* TrackBase.h in Headers */,
+                               070584FD17F9D6DF005F2BCB /* MediaStreamSourceCapabilities.h in Headers */,
                                BE88E0C21715CE2600658D98 /* TrackListBase.h in Headers */,
                                CD3A495F17A9D01B00274E42 /* MediaSource.h in Headers */,
                                49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */,
                                BE88E0E21715D2A200658D98 /* VideoTrackList.h in Headers */,
                                E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */,
                                BEF29EEC1715DD0900C4B4C9 /* VideoTrackPrivate.h in Headers */,
+                               0705851B17FB44B4005F2BCB /* JSAllAudioCapabilities.h in Headers */,
                                CEF418CF1179678C009D112C /* ViewportArguments.h in Headers */,
                                3FFFF9AE159D9B060020BBD5 /* ViewportStyleResolver.h in Headers */,
                                93309E20099E64920056E581 /* VisiblePosition.h in Headers */,
                                83C1D428178D5AB400141E68 /* SVGPathSegCurvetoCubicRel.h in Headers */,
                                83C1D429178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothAbs.h in Headers */,
                                83C1D42A178D5AB400141E68 /* SVGPathSegCurvetoCubicSmoothRel.h in Headers */,
+                               07C59B7217F79C7C000FBCBB /* JSMediaSourceStates.h in Headers */,
                                83C1D42B178D5AB400141E68 /* SVGPathSegCurvetoQuadraticAbs.h in Headers */,
                                83C1D42C178D5AB500141E68 /* SVGPathSegCurvetoQuadraticRel.h in Headers */,
                                83C1D42D178D5AB500141E68 /* SVGPathSegCurvetoQuadraticSmoothAbs.h in Headers */,
                                FD31602412B0267600C1A359 /* BiquadDSPKernel.cpp in Sources */,
                                FDC54F041399B0DA008D9117 /* BiquadFilterNode.cpp in Sources */,
                                FD31602612B0267600C1A359 /* BiquadProcessor.cpp in Sources */,
+                               070584FF17F9F05E005F2BCB /* CapabilityRange.cpp in Sources */,
                                A89943290B42338800D7C802 /* BitmapImage.cpp in Sources */,
                                377A3A9015EFCE9B0059F5C7 /* BitmapImageCG.cpp in Sources */,
                                976D6C78122B8A3D001FD1F7 /* Blob.cpp in Sources */,
                                85CA975D0A962E5400690CCF /* DOMDocumentType.mm in Sources */,
                                8518DCEA0A9CC80D0091B7A6 /* DOMDOMImplementation.mm in Sources */,
                                52CCA9E915E3F64C0053C77F /* DOMDOMNamedFlowCollection.mm in Sources */,
+                               0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */,
                                2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */,
                                7694565C1214DB630007CBAE /* DOMDOMTokenList.mm in Sources */,
                                7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
                                859A9C480AA5E3BD00B694B2 /* DOMHTMLBaseElement.mm in Sources */,
                                078E090417D14CEE00420AA1 /* NavigatorMediaStream.cpp in Sources */,
                                85ECBEEE0AA7626900544F0B /* DOMHTMLBaseFontElement.mm in Sources */,
+                               07C59B6817F784BA000FBCBB /* MediaSourceStates.cpp in Sources */,
                                859A9C4A0AA5E3BD00B694B2 /* DOMHTMLBodyElement.mm in Sources */,
                                85183B430AA6926100F19FA3 /* DOMHTMLBRElement.mm in Sources */,
                                85BA4CDE0AA6861B0088052D /* DOMHTMLButtonElement.mm in Sources */,
                                85DF2F8F0AA3C88100AD64C5 /* DOMHTMLCollection.mm in Sources */,
                                078E090017D14CEE00420AA1 /* MediaStreamEvent.cpp in Sources */,
                                F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */,
+                               0705852317FDC140005F2BCB /* MediaTrackConstraints.cpp in Sources */,
                                D359D792129CA3C00006E5D2 /* DOMHTMLDetailsElement.mm in Sources */,
                                85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */,
                                85BA4D0E0AA688680088052D /* DOMHTMLDivElement.mm in Sources */,
                                B275358E0B053A66002CE64F /* IconMac.mm in Sources */,
                                51E1ECC00C91C90400DC255B /* IconRecord.cpp in Sources */,
                                45099C411370A7800058D513 /* IconURL.cpp in Sources */,
+                               0705851517FB0EEA005F2BCB /* MediaStreamCapabilities.cpp in Sources */,
                                C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */,
                                9712A5C515004EDA0048AF10 /* IDBDatabaseCallbacksImpl.cpp in Sources */,
                                9712A5C915004EDA0048AF10 /* IDBDatabaseException.cpp in Sources */,
                                9712A5EF15004EDA0048AF10 /* IDBPendingTransactionMonitor.cpp in Sources */,
                                9712A5FE15004EDA0048AF10 /* IDBVersionChangeEvent.cpp in Sources */,
                                1A71D57B0F33819000F9CE4E /* IdentifierRep.cpp in Sources */,
+                               0705853117FDE6D9005F2BCB /* JSMediaTrackConstraint.cpp in Sources */,
                                5913A24113D49EBA00F5B05C /* IdentifiersFactory.cpp in Sources */,
                                C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */,
                                C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */,
                                51EC92650CE90DD400F90308 /* JSCustomSQLStatementErrorCallback.cpp in Sources */,
                                E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */,
                                1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */,
+                               07C59B6E17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp in Sources */,
                                B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */,
                                B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */,
                                4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */,
                                1AE2AA2E0A1CDAB400B42B25 /* JSHTMLHeadingElement.cpp in Sources */,
                                1AE2AA300A1CDAB400B42B25 /* JSHTMLHRElement.cpp in Sources */,
                                1A85B18F0A1B18A200D8C87C /* JSHTMLHtmlElement.cpp in Sources */,
+                               0705853817FE044F005F2BCB /* MediaTrackConstraintSet.cpp in Sources */,
                                BC4918C80BFEA050009D6316 /* JSHTMLIFrameElement.cpp in Sources */,
                                1AE2AA970A1CDD2D00B42B25 /* JSHTMLImageElement.cpp in Sources */,
                                A80E7E980A1A83E3007FB8C5 /* JSHTMLInputElement.cpp in Sources */,
                                7E46F6FA1627A2CA00062223 /* JSOESElementIndexUint.cpp in Sources */,
                                9001788012E0370700648462 /* JSOESStandardDerivatives.cpp in Sources */,
                                6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */,
+                               0705853A17FE0770005F2BCB /* MediaTrackConstraint.cpp in Sources */,
                                A31C4E5216E02B08002F7957 /* JSOESTextureHalfFloat.cpp in Sources */,
                                77A17AA612F28B2A004E02F6 /* JSOESVertexArrayObject.cpp in Sources */,
                                FDF6BAF8134A4C9800822920 /* JSOfflineAudioCompletionEvent.cpp in Sources */,
                                985BB96D13A94058007A0B69 /* LinkRelAttribute.cpp in Sources */,
                                BC7FA6200D1F0CBD00DB22A9 /* LiveNodeList.cpp in Sources */,
                                078E091017D14CEE00420AA1 /* RTCStatsResponse.cpp in Sources */,
+                               0705850217FA10D0005F2BCB /* JSAllVideoCapabilities.cpp in Sources */,
                                9759E93E14EF1CF80026A2DD /* LoadableTextTrack.cpp in Sources */,
                                656D37330ADBA5DE00A4554D /* LoaderNSURLExtras.mm in Sources */,
                                7EE6846812D26E3800E79415 /* LoaderRunLoopCF.cpp in Sources */,
                                BC25B52A131C6D3900180E10 /* LocalizedStringsMac.cpp in Sources */,
                                BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */,
                                078E090817D14CEE00420AA1 /* RTCDTMFToneChangeEvent.cpp in Sources */,
+                               0705851A17FB44B4005F2BCB /* JSAllAudioCapabilities.cpp in Sources */,
                                A8239E0009B3CF8A00B60641 /* Logging.cpp in Sources */,
                                1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */,
                                1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */,
                                D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */,
                                C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */,
                                52B6C9C515E3F4DF00690B05 /* NamedFlowCollection.cpp in Sources */,
+                               0705853317FDE6D9005F2BCB /* JSMediaTrackConstraints.cpp in Sources */,
                                BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */,
                                A81872240977D3C0005826D9 /* NameNodeList.cpp in Sources */,
                                E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */,
                                934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */,
                                7EE6846B12D26E3800E79415 /* ResourceErrorCF.cpp in Sources */,
                                514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */,
+                               0705851217FA7107005F2BCB /* JSMediaStreamCapabilities.cpp in Sources */,
                                514C76780CE923A1007EF3CD /* ResourceHandle.cpp in Sources */,
                                7EE6846C12D26E3800E79415 /* ResourceHandleCFNet.cpp in Sources */,
                                E1BA003116FB92AC00BA7A35 /* ResourceHandleClient.cpp in Sources */,
                                B22279C40D00BF220071B782 /* SVGExternalResourcesRequired.cpp in Sources */,
                                B22279C70D00BF220071B782 /* SVGFEBlendElement.cpp in Sources */,
                                B22279CA0D00BF220071B782 /* SVGFEColorMatrixElement.cpp in Sources */,
+                               0705853517FDE6D9005F2BCB /* JSMediaTrackConstraintSet.cpp in Sources */,
                                B22279CD0D00BF220071B782 /* SVGFEComponentTransferElement.cpp in Sources */,
                                B22279D00D00BF220071B782 /* SVGFECompositeElement.cpp in Sources */,
                                1921327411C0E6BB00456238 /* SVGFEConvolveMatrixElement.cpp in Sources */,
                                B2227A3B0D00BF220071B782 /* SVGLineElement.cpp in Sources */,
                                B2227A400D00BF220071B782 /* SVGLocatable.cpp in Sources */,
                                B2227A430D00BF220071B782 /* SVGMarkerElement.cpp in Sources */,
+                               0705851717FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp in Sources */,
                                B2227A460D00BF220071B782 /* SVGMaskElement.cpp in Sources */,
                                B2227A4A0D00BF220071B782 /* SVGMetadataElement.cpp in Sources */,
                                B2A1F2B00CEF0ABF00442F6A /* SVGMissingGlyphElement.cpp in Sources */,
                                B2227AF20D00BF220071B782 /* SVGViewSpec.cpp in Sources */,
                                8485228A1190173C006EDC7F /* SVGVKernElement.cpp in Sources */,
                                B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
+                               073AB4B717F92ECF006E0D6F /* JSCapabilityRange.cpp in Sources */,
                                B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
                                E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */,
                                E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */,
                                97AABD1A14FA09D5007457AE /* WebSocket.cpp in Sources */,
                                97AABD1D14FA09D5007457AE /* WebSocketChannel.cpp in Sources */,
                                4A38BF5014FE1C0900612512 /* WebSocketDeflateFramer.cpp in Sources */,
+                               07C59B7117F79C7C000FBCBB /* JSMediaSourceStates.cpp in Sources */,
                                97AABD2014FA09D5007457AE /* WebSocketDeflater.cpp in Sources */,
                                97AABD2214FA09D5007457AE /* WebSocketExtensionDispatcher.cpp in Sources */,
                                4A5A2ADB161E7E00005889DD /* WebSocketExtensionParser.cpp in Sources */,
diff --git a/Source/WebCore/bindings/js/JSMediaSourceStatesCustom.cpp b/Source/WebCore/bindings/js/JSMediaSourceStatesCustom.cpp
new file mode 100644 (file)
index 0000000..cd145a6
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "JSMediaSourceStates.h"
+
+#include "MediaSourceStates.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSMediaSourceStates::width(ExecState*) const
+{
+    if (!impl()->hasVideoSource())
+        return jsUndefined();
+
+    return jsNumber(impl()->width());
+}
+
+JSValue JSMediaSourceStates::height(ExecState*) const
+{
+    if (!impl()->hasVideoSource())
+        return jsUndefined();
+    
+    return jsNumber(impl()->height());
+}
+
+JSValue JSMediaSourceStates::frameRate(ExecState*) const
+{
+    if (!impl()->hasVideoSource())
+        return jsUndefined();
+    
+    return jsNumber(impl()->frameRate());
+}
+
+JSValue JSMediaSourceStates::aspectRatio(ExecState*) const
+{
+    if (!impl()->hasVideoSource())
+        return jsUndefined();
+    
+    return jsNumber(impl()->aspectRatio());
+}
+
+JSValue JSMediaSourceStates::facingMode(ExecState* exec) const
+{
+    if (!impl()->hasVideoSource())
+        return jsUndefined();
+
+    return jsStringWithCache(exec, impl()->facingMode());
+}
+
+JSValue JSMediaSourceStates::volume(ExecState*) const
+{
+    if (impl()->hasVideoSource())
+        return jsUndefined();
+    
+    return jsNumber(impl()->volume());
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp b/Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp
new file mode 100644 (file)
index 0000000..9ad691d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 "JSMediaStreamCapabilities.h"
+
+#include "JSAllAudioCapabilities.h"
+#include "JSAllVideoCapabilities.h"
+#include "MediaStreamCapabilities.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, MediaStreamCapabilities* object)
+{
+    if (!object)
+        return jsNull();
+
+    if (object->hasVideoSource())
+        return wrap<JSAllVideoCapabilities>(exec, globalObject, static_cast<AllVideoCapabilities*>(object));
+
+    return wrap<JSAllAudioCapabilities>(exec, globalObject, static_cast<AllAudioCapabilities*>(object));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
index d2c34b3..6a3661e 100644 (file)
@@ -238,6 +238,7 @@ namespace WebCore {
     macro(removestream) \
     macro(signalingstatechange) \
     macro(removetrack) \
+    macro(overconstrained) \
     macro(mute) \
     macro(unmute) \
     macro(started) \
index f24f3db..03ea139 100644 (file)
@@ -67,11 +67,6 @@ MediaStreamCenter::~MediaStreamCenter()
 {
 }
 
-void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
-{
-    streamDescriptor->setEnded();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 82c2e3b..e991b03 100644 (file)
@@ -34,6 +34,7 @@
 
 #if ENABLE(MEDIA_STREAM)
 
+#include "MediaStreamSource.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -43,9 +44,11 @@ class MediaConstraints;
 class MediaStreamCreationClient;
 class MediaStreamCreationClient;
 class MediaStreamDescriptor;
-class MediaStreamSource;
+class MediaStreamSourceCapabilities;
 class MediaStreamTrackSourcesRequestClient;
 
+struct MediaStreamSourceStates;
+
 class MediaStreamCenter {
 public:
     virtual ~MediaStreamCenter();
@@ -59,14 +62,6 @@ public:
 
     virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) = 0;
 
-    virtual void didSetMediaStreamTrackEnabled(MediaStreamSource*) = 0;
-
-    virtual bool didAddMediaStreamTrack(MediaStreamSource*) = 0;
-    virtual bool didRemoveMediaStreamTrack(MediaStreamSource*) = 0;
-
-    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) = 0;
-    virtual void didCreateMediaStream(MediaStreamDescriptor*) = 0;
-
 protected:
     MediaStreamCenter();
 
index 3dd9bfd..5629987 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "MediaStreamDescriptor.h"
 
+#include "MediaStreamCenter.h"
 #include "MediaStreamSource.h"
 #include "UUID.h"
 #include <wtf/RefCounted.h>
@@ -47,6 +48,15 @@ PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const MediaStrea
     return adoptRef(new MediaStreamDescriptor(createCanonicalUUIDString(), audioSources, videoSources));
 }
 
+MediaStreamDescriptor::~MediaStreamDescriptor()
+{
+    for (size_t i = 0; i < m_audioStreamSources.size(); i++)
+        m_audioStreamSources[i]->setStream(0);
+    
+    for (size_t i = 0; i < m_videoStreamSources.size(); i++)
+        m_videoStreamSources[i]->setStream(0);
+}
+
 void MediaStreamDescriptor::addSource(PassRefPtr<MediaStreamSource> source)
 {
     switch (source->type()) {
@@ -67,15 +77,19 @@ void MediaStreamDescriptor::removeSource(PassRefPtr<MediaStreamSource> source)
     switch (source->type()) {
     case MediaStreamSource::Audio:
         pos = m_audioStreamSources.find(source);
-        if (pos != notFound)
-            m_audioStreamSources.remove(pos);
+        if (pos == notFound)
+            return;
+        m_audioStreamSources.remove(pos);
         break;
     case MediaStreamSource::Video:
         pos = m_videoStreamSources.find(source);
-        if (pos != notFound)
-            m_videoStreamSources.remove(pos);
+        if (pos == notFound)
+            return;
+        m_videoStreamSources.remove(pos);
         break;
     }
+
+    source->setStream(0);
 }
 
 void MediaStreamDescriptor::addRemoteSource(MediaStreamSource* source)
index b623e59..0c0fb3b 100644 (file)
@@ -52,9 +52,10 @@ public:
 
 class MediaStreamDescriptor : public RefCounted<MediaStreamDescriptor> {
 public:
-
     static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
 
+    virtual ~MediaStreamDescriptor();
+
     MediaStreamDescriptorClient* client() const { return m_client; }
     void setClient(MediaStreamDescriptorClient* client) { m_client = client; }
 
index caea8ca..6dbdb97 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
+ * 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
 
 #include "MediaStreamSource.h"
 
-#include "AudioDestinationConsumer.h"
+#include "MediaStreamCenter.h"
+#include "MediaStreamSourceCapabilities.h"
+#include "UUID.h"
+
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
-PassRefPtr<MediaStreamSource> MediaStreamSource::create(const String& id, Type type, const String& name, ReadyState readyState, bool requiresConsumer)
-{
-    return adoptRef(new MediaStreamSource(id, type, name, readyState, requiresConsumer));
-}
-
-MediaStreamSource::MediaStreamSource(const String& id, Type type, const String& name, ReadyState readyState, bool requiresConsumer)
+MediaStreamSource::MediaStreamSource(const String& id, Type type, const String& name)
     : m_id(id)
     , m_type(type)
     , m_name(name)
-    , m_readyState(readyState)
+    , m_readyState(New)
     , m_stream(0)
-    , m_requiresConsumer(requiresConsumer)
     , m_enabled(true)
     , m_muted(false)
+    , m_readonly(false)
+    , m_remote(false)
 {
+    if (!m_id.isEmpty())
+        return;
+    
+    m_id = createCanonicalUUIDString();
+}
+
+void MediaStreamSource::reset()
+{
+    m_readyState = New;
+    m_stream = 0;
+    m_enabled = true;
+    m_muted = false;
+    m_readonly = false;
+    m_remote = false;
 }
 
 void MediaStreamSource::setReadyState(ReadyState readyState)
@@ -63,7 +77,7 @@ void MediaStreamSource::setReadyState(ReadyState readyState)
 
     m_readyState = readyState;
     for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i)
-        (*i)->sourceChangedState();
+        (*i)->sourceStateChanged();
 }
 
 void MediaStreamSource::addObserver(MediaStreamSource::Observer* observer)
@@ -80,53 +94,74 @@ void MediaStreamSource::removeObserver(MediaStreamSource::Observer* observer)
 
 void MediaStreamSource::setStream(MediaStreamDescriptor* stream)
 {
-    ASSERT(!m_stream && stream);
+    // FIXME: A source should not need to know about its stream(s). This will be fixed as a part of
+    // https://bugs.webkit.org/show_bug.cgi?id=121954
     m_stream = stream;
 }
 
+MediaConstraints* MediaStreamSource::constraints() const
+{
+    // FIXME: While this returns 
+    // https://bugs.webkit.org/show_bug.cgi?id=122428
+    return m_constraints.get();
+}
+    
+void MediaStreamSource::setConstraints(PassRefPtr<MediaConstraints> constraints)
+{
+    m_constraints = constraints;
+}
+
 void MediaStreamSource::setMuted(bool muted)
 {
     if (m_muted == muted)
         return;
 
     m_muted = muted;
+
+    if (m_readyState == Ended)
+        return;
+
     for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i)
-        (*i)->sourceChangedState();
+        (*i)->sourceMutedChanged();
 }
 
-void MediaStreamSource::addAudioConsumer(PassRefPtr<AudioDestinationConsumer> consumer)
+void MediaStreamSource::setEnabled(bool enabled)
 {
-    ASSERT(m_requiresConsumer);
-    MutexLocker locker(m_audioConsumersLock);
-    m_audioConsumers.append(consumer);
-}
+    if (m_enabled == enabled)
+        return;
+    
+    m_enabled = enabled;
 
-bool MediaStreamSource::removeAudioConsumer(AudioDestinationConsumer* consumer)
-{
-    ASSERT(m_requiresConsumer);
-    MutexLocker locker(m_audioConsumersLock);
-    size_t pos = m_audioConsumers.find(consumer);
-    if (pos != notFound) {
-        m_audioConsumers.remove(pos);
-        return true;
-    }
-    return false;
+    if (m_readyState == Ended)
+        return;
+    
+    for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i)
+        (*i)->sourceEnabledChanged();
 }
 
-void MediaStreamSource::setAudioFormat(size_t numberOfChannels, float sampleRate)
+bool MediaStreamSource::readonly() const
 {
-    ASSERT(m_requiresConsumer);
-    MutexLocker locker(m_audioConsumersLock);
-    for (Vector<RefPtr<AudioDestinationConsumer> >::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)
-        (*it)->setFormat(numberOfChannels, sampleRate);
+    // http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrack-_readonly
+    // If the track (audio or video) is backed by a read-only source such as a file, or the track source 
+    // is a local microphone or camera, but is shared so that this track cannot modify any of the source's
+    // settings, the readonly attribute must return the value true. Otherwise, it must return the value false.
+    return m_readonly;
 }
 
-void MediaStreamSource::consumeAudio(AudioBus* bus, size_t numberOfFrames)
+void MediaStreamSource::stop()
 {
-    ASSERT(m_requiresConsumer);
-    MutexLocker locker(m_audioConsumersLock);
-    for (Vector<RefPtr<AudioDestinationConsumer> >::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)
-        (*it)->consumeAudio(bus, numberOfFrames);
+    for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i) {
+        if (!(*i)->stopped())
+            return;
+    }
+
+    // There are no more consumers of this source's data, shut it down as appropriate.
+    setReadyState(Ended);
+
+    // http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrack-stop-void
+    // If the data is being generated from a live source (e.g., a microphone or camera), then the user 
+    // agent should remove any active "on-air" indicator for that source. If the data is being 
+    // generated from a prerecorded source (e.g. a video file), any remaining content in the file is ignored.
 }
 
 } // namespace WebCore
index 74f59a5..328a895 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2011 Ericsson AB. All rights reserved.
  * Copyright (C) 2012 Google Inc. All rights reserved.
+ * 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
@@ -36,6 +37,7 @@
 
 #include "AudioDestinationConsumer.h"
 #include "MediaConstraints.h"
+#include "MediaStreamSourceCapabilities.h"
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 namespace WebCore {
 
 class AudioBus;
+class MediaConstraints;
 class MediaStreamDescriptor;
+struct MediaStreamSourceStates;
 
 class MediaStreamSource : public RefCounted<MediaStreamSource> {
 public:
     class Observer {
     public:
         virtual ~Observer() { }
-        virtual void sourceChangedState() = 0;
+        virtual void sourceStateChanged() = 0;
+        virtual void sourceMutedChanged() = 0;
+        virtual void sourceEnabledChanged() = 0;
+        virtual bool stopped() = 0;
     };
 
     enum Type { Audio, Video };
     enum ReadyState { New = 0, Live = 1, Ended = 2 };
 
-    static PassRefPtr<MediaStreamSource> create(const String& id, Type, const String& name, ReadyState = New, bool requiresConsumer = false);
+    virtual ~MediaStreamSource() { }
 
-    const String& id() const { return m_id; }
+    virtual bool isAudioStreamSource() const { return false; }
+    virtual bool useIDForTrackID() const { return false; }
+
+    void reset();
 
+    const String& id() const { return m_id; }
     Type type() const { return m_type; }
     const String& name() const { return m_name; }
 
+    virtual RefPtr<MediaStreamSourceCapabilities> capabilities() const = 0;
+    virtual const MediaStreamSourceStates& states() = 0;
+    
     void setReadyState(ReadyState);
     ReadyState readyState() const { return m_readyState; }
 
     void addObserver(Observer*);
     void removeObserver(Observer*);
 
-    void setConstraints(PassRefPtr<MediaConstraints> constraints) { m_constraints = constraints; }
-    MediaConstraints* constraints() const { return m_constraints.get(); }
-
-    const String& deviceId() const { return m_deviceId; }
-    void setDeviceId(const String& deviceId) { m_deviceId = deviceId; }
+    void setConstraints(PassRefPtr<MediaConstraints>);
+    MediaConstraints* constraints() const;
 
     bool enabled() const { return m_enabled; }
-    void setEnabled(bool enabled) { m_enabled = enabled; }
+    void setEnabled(bool);
 
     bool muted() const { return m_muted; }
     void setMuted(bool);
-    
-    void setAudioFormat(size_t numberOfChannels, float sampleRate);
-    void consumeAudio(AudioBus*, size_t numberOfFrames);
+
+    bool readonly() const;
+    void setReadonly(bool readonly) { m_readonly = readonly; }
+
+    bool remote() const { return m_remote; }
+    void setRemote(bool remote) { m_remote = remote; }
+
+    void stop();
 
     MediaStreamDescriptor* stream() const { return m_stream; }
     void setStream(MediaStreamDescriptor*);
-
-    bool requiresAudioConsumer() const { return m_requiresConsumer; }
-    void addAudioConsumer(PassRefPtr<AudioDestinationConsumer>);
-    bool removeAudioConsumer(AudioDestinationConsumer*);
-    const Vector<RefPtr<AudioDestinationConsumer> >& audioConsumers() const { return m_audioConsumers; }
+    
+protected:
+    MediaStreamSource(const String& id, Type, const String& name);
 
 private:
-    MediaStreamSource(const String& id, Type, const String& name, ReadyState, bool requiresConsumer);
-
     String m_id;
     Type m_type;
     String m_name;
     ReadyState m_readyState;
-    String m_deviceId;
     Vector<Observer*> m_observers;
-    Mutex m_audioConsumersLock;
-    Vector<RefPtr<AudioDestinationConsumer>> m_audioConsumers;
     RefPtr<MediaConstraints> m_constraints;
     MediaStreamDescriptor* m_stream;
+    MediaStreamSourceStates m_states;
 
-    bool m_requiresConsumer;
     bool m_enabled;
     bool m_muted;
+    bool m_readonly;
+    bool m_remote;
 };
 
 typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector;
diff --git a/Source/WebCore/platform/mediastream/MediaStreamSourceCapabilities.h b/Source/WebCore/platform/mediastream/MediaStreamSourceCapabilities.h
new file mode 100644 (file)
index 0000000..8424588
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * 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 COMPUTER, 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 COMPUTER, 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 MediaStreamSourceCapabilities_h
+#define MediaStreamSourceCapabilities_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+struct MediaStreamSourceStates {
+public:
+    enum SourceType { None, Camera, Microphone };
+    enum VideoFacingMode { User, Environment, Left, Right };
+
+    MediaStreamSourceStates()
+        : sourceType(None)
+        , facingMode(User)
+        , width(0)
+        , height(0)
+        , frameRate(0)
+        , aspectRatio(0)
+        , volume(0)
+    {
+    }
+
+    SourceType sourceType;
+    AtomicString sourceId;
+    VideoFacingMode facingMode;
+    unsigned long width;
+    unsigned long height;
+    float frameRate;
+    float aspectRatio;
+    unsigned long volume;
+    
+    bool hasVideoSource;
+};
+
+class MediaStreamSourceCapabilityRange {
+public:
+    
+    MediaStreamSourceCapabilityRange(float min, float max, bool supported = true)
+        : m_type(Float)
+    {
+        m_min.asFloat = min;
+        m_max.asFloat = max;
+        m_supported = supported;
+    }
+    
+    MediaStreamSourceCapabilityRange(unsigned long min, unsigned long max, bool supported = true)
+        : m_type(ULong)
+    {
+        m_min.asULong = min;
+        m_max.asULong = max;
+        m_supported = supported;
+    }
+    
+    MediaStreamSourceCapabilityRange()
+    {
+        m_type = Undefined;
+        m_min.asULong = 0;
+        m_max.asULong = 0;
+        m_supported = false;
+    }
+    
+    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; }
+    
+private:
+    ValueUnion m_min;
+    ValueUnion m_max;
+    Type m_type;
+    bool m_supported;
+};
+
+class MediaStreamSourceCapabilities : public RefCounted<MediaStreamSourceCapabilities> {
+public:
+    static PassRefPtr<MediaStreamSourceCapabilities> create()
+    {
+        return adoptRef(new MediaStreamSourceCapabilities());
+    }
+
+    ~MediaStreamSourceCapabilities() { }
+
+    const Vector<MediaStreamSourceStates::SourceType>& sourceTypes() { return m_sourceType; }
+    void addSourceType(MediaStreamSourceStates::SourceType sourceType)
+    {
+        if (sourceType == MediaStreamSourceStates::Camera)
+            m_videoSource = true;
+        m_sourceType.append(sourceType);
+    }
+
+    const Vector<AtomicString>& sourceId() { return m_sourceId; }
+    void setSourceId(const AtomicString& id)  { m_sourceId.reserveCapacity(1); m_sourceId.insert(0, id); }
+
+    const Vector<MediaStreamSourceStates::VideoFacingMode>& facingModes() { return m_facingMode; }
+    void addFacingMode(MediaStreamSourceStates::VideoFacingMode mode) { m_facingMode.append(mode); }
+
+    const MediaStreamSourceCapabilityRange& width() { return m_width; }
+    void setWidthRange(const MediaStreamSourceCapabilityRange& width) { m_width = width; }
+
+    const MediaStreamSourceCapabilityRange& height() { return m_height; }
+    void setHeightRange(const MediaStreamSourceCapabilityRange& height) { m_height = height; }
+
+    const MediaStreamSourceCapabilityRange& frameRate() { return m_frameRate; }
+    void setFrameRateRange(const MediaStreamSourceCapabilityRange& frameRate) { m_frameRate = frameRate; }
+
+    const MediaStreamSourceCapabilityRange& aspectRatio() { return m_aspectRatio; }
+    void setAspectRatioRange(const MediaStreamSourceCapabilityRange& aspectRatio) { m_aspectRatio = aspectRatio; }
+
+    const MediaStreamSourceCapabilityRange& volume() { return m_volume; }
+    void setVolumeRange(const MediaStreamSourceCapabilityRange& volume) { m_volume = volume; }
+
+    bool hasVideoSource() { return m_videoSource; }
+    void setHasVideoSource(bool isVideo) { m_videoSource = isVideo;; }
+
+private:
+    MediaStreamSourceCapabilities()
+        : m_videoSource(false)
+    {
+    }
+
+    Vector<AtomicString> m_sourceId;
+    Vector<MediaStreamSourceStates::SourceType> m_sourceType;
+    Vector<MediaStreamSourceStates::VideoFacingMode> m_facingMode;
+
+    MediaStreamSourceCapabilityRange m_width;
+    MediaStreamSourceCapabilityRange m_height;
+    MediaStreamSourceCapabilityRange m_frameRate;
+    MediaStreamSourceCapabilityRange m_aspectRatio;
+    MediaStreamSourceCapabilityRange m_volume;
+
+    bool m_videoSource;
+};
+
+} // namespace WebCore
+
+#endif // MediaStreamSourceCapabilities_h
+
+#endif
index afdbfe3..8567451 100644 (file)
 
 #include "MediaStreamCenterBlackBerry.h"
 
+#include "MediaStreamCreationClient.h"
 #include "MediaStreamDescriptor.h"
-#include "MediaStreamSourcesQueryClient.h"
+#include "MediaStreamTrackSourcesRequestClient.h"
+#include "NotImplemented.h"
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -72,33 +74,6 @@ bool MediaStreamCenterBlackBerry::getMediaStreamTrackSources(PassRefPtr<MediaStr
     return false;
 }
 
-void MediaStreamCenterBlackBerry::didSetMediaStreamTrackEnabled(MediaStreamSource*)
-{
-    notImplemented();
-}
-
-bool MediaStreamCenterBlackBerry::didAddMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-bool MediaStreamCenterBlackBerry::didRemoveMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-void MediaStreamCenterBlackBerry::didStopLocalMediaStream(MediaStreamDescriptor* stream)
-{
-    endLocalMediaStream(stream);
-}
-
-void MediaStreamCenterBlackBerry::didCreateMediaStream(MediaStreamDescriptor*)
-{
-    notImplemented();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index e34d892..dd35a25 100644 (file)
@@ -50,15 +50,9 @@ public:
     MediaStreamCenterBlackBerry();
     ~MediaStreamCenterBlackBerry();
 
-    // MediaStreamCenter
     virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) OVERRIDE;
-    virtual void didSetMediaStreamTrackEnabled(MediaStreamSource*) OVERRIDE;
-    virtual bool didAddMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual bool didRemoveMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
-    virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
 };
 
 } // namespace WebCore
index 5b15f89..cdfb871 100644 (file)
 
 #include "MediaStreamCenterGStreamer.h"
 
+#include "MediaStreamCreationClient.h"
 #include "MediaStreamDescriptor.h"
+#include "MediaStreamSourceCapabilities.h"
+#include "MediaStreamSourceStates.h"
+#include "MediaStreamTrackSourcesRequestClient.h"
 #include "NotImplemented.h"
 #include <wtf/MainThread.h>
 
@@ -72,33 +76,6 @@ bool MediaStreamCenterGStreamer::getMediaStreamTrackSources(PassRefPtr<MediaStre
     return false;
 }
 
-void MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled(MediaStreamSource*)
-{
-    notImplemented();
-}
-
-bool MediaStreamCenterGStreamer::didAddMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-bool MediaStreamCenterGStreamer::didRemoveMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-void MediaStreamCenterGStreamer::didStopLocalMediaStream(MediaStreamDescriptor* stream)
-{
-    endLocalMediaStream(stream);
-}
-
-void MediaStreamCenterGStreamer::didCreateMediaStream(MediaStreamDescriptor*)
-{
-    notImplemented();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index df133af..4e435ec 100644 (file)
@@ -50,15 +50,9 @@ public:
     MediaStreamCenterGStreamer();
     ~MediaStreamCenterGStreamer();
 
-    // MediaStreamCenter
     virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) OVERRIDE;
-    virtual void didSetMediaStreamTrackEnabled(MediaStreamSource*) OVERRIDE;
-    virtual bool didAddMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual bool didRemoveMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
-    virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
 };
 
 } // namespace WebCore
index 2c1610b..5fd52bf 100644 (file)
@@ -73,33 +73,6 @@ bool MediaStreamCenterMac::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrac
     return false;
 }
 
-void MediaStreamCenterMac::didSetMediaStreamTrackEnabled(MediaStreamSource*)
-{
-    notImplemented();
-}
-
-bool MediaStreamCenterMac::didAddMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-bool MediaStreamCenterMac::didRemoveMediaStreamTrack(MediaStreamSource*)
-{
-    notImplemented();
-    return false;
-}
-
-void MediaStreamCenterMac::didStopLocalMediaStream(MediaStreamDescriptor* stream)
-{
-    endLocalMediaStream(stream);
-}
-
-void MediaStreamCenterMac::didCreateMediaStream(MediaStreamDescriptor*)
-{
-    notImplemented();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 59df80d..1b029b2 100644 (file)
 
 #include "MediaStreamCenter.h"
 
+#include "MediaStreamSource.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class MediaStreamDescriptor;
-class MediaStreamSource;
-class MediaStreamSourcesQueryClient;
-
 class MediaStreamCenterMac FINAL : public MediaStreamCenter {
 public:
     MediaStreamCenterMac();
     ~MediaStreamCenterMac();
 
-    // MediaStreamCenter
     virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) OVERRIDE;
-    virtual void didSetMediaStreamTrackEnabled(MediaStreamSource*) OVERRIDE;
-    virtual bool didAddMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual bool didRemoveMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
-    virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
 };
 
 } // namespace WebCore
index 31795dc..c8e7447 100644 (file)
 #include "MediaStream.h"
 #include "MediaStreamCreationClient.h"
 #include "MediaStreamDescriptor.h"
+#include "MediaStreamSource.h"
+#include "MediaStreamSourceCapabilities.h"
 #include "MediaStreamTrack.h"
 #include "MediaStreamTrackSourcesRequestClient.h"
-#include "NotImplemented.h"
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
+class MockSource : public MediaStreamSource {
+public:
+    MockSource(const AtomicString& id, const AtomicString& name, MediaStreamSource::Type type)
+        : MediaStreamSource(id, type, name)
+    {
+    }
+
+    virtual ~MockSource() { }
+
+    virtual RefPtr<MediaStreamSourceCapabilities> capabilities() const { return m_capabilities; }
+    virtual const MediaStreamSourceStates& states() { return m_currentStates; }
+
+    RefPtr<MediaStreamSourceCapabilities> m_capabilities;
+    MediaStreamSourceStates m_currentStates;
+};
+    
+typedef HashMap<String, RefPtr<MockSource>> MockSourceMap;
+
+static MockSourceMap& mockSourceMap()
+{
+    DEFINE_STATIC_LOCAL(MockSourceMap, mockSourceMap, ());
+    return mockSourceMap;
+}
+
+static const AtomicString& mockAudioSourceID()
+{
+    static NeverDestroyed<AtomicString> id("239c24b1-2b15-11e3-8224-0800200c9a66", AtomicString::ConstructFromLiteral);
+    return id;
+}
+
+static const AtomicString& mockVideoSourceID()
+{
+    static NeverDestroyed<AtomicString> id("239c24b0-2b15-11e3-8224-0800200c9a66", AtomicString::ConstructFromLiteral);
+    return id;
+}
+
+static void initializeMockSources()
+{
+    RefPtr<MockSource> mockSource1 = adoptRef(new MockSource(mockVideoSourceID(), "Mock video device", MediaStreamSource::Video));
+    mockSource1->m_capabilities = MediaStreamSourceCapabilities::create();
+    mockSource1->m_capabilities->setSourceId(mockSource1->id());
+    mockSource1->m_capabilities->addSourceType(MediaStreamSourceStates::Camera);
+    mockSource1->m_capabilities->addSourceType(MediaStreamSourceStates::Microphone);
+    mockSource1->m_capabilities->addFacingMode(MediaStreamSourceStates::User);
+    mockSource1->m_capabilities->addFacingMode(MediaStreamSourceStates::Environment);
+    mockSource1->m_capabilities->setWidthRange(MediaStreamSourceCapabilityRange(320UL, 1920UL, true));
+    mockSource1->m_capabilities->setHeightRange(MediaStreamSourceCapabilityRange(240UL, 1080UL, true));
+    mockSource1->m_capabilities->setFrameRateRange(MediaStreamSourceCapabilityRange(15.0f, 60.0f, true));
+    mockSource1->m_capabilities->setAspectRatioRange(MediaStreamSourceCapabilityRange(4 / 3.0f, 16 / 9.0f, true));
+    mockSource1->m_capabilities->setVolumeRange(MediaStreamSourceCapabilityRange(10UL, 90UL, true));
+
+    mockSource1->m_currentStates.sourceType = MediaStreamSourceStates::Camera;
+    mockSource1->m_currentStates.sourceId = mockSource1->id();
+    mockSource1->m_currentStates.facingMode = MediaStreamSourceStates::User;
+    mockSource1->m_currentStates.width = 1920;
+    mockSource1->m_currentStates.height = 1080;
+    mockSource1->m_currentStates.frameRate = 30;
+    mockSource1->m_currentStates.aspectRatio = 16 / 9.0f;
+    mockSource1->m_currentStates.volume = 70;
+    mockSourceMap().add(mockSource1->id(), mockSource1.release());
+
+    RefPtr<MockSource> mockSource2 = adoptRef(new MockSource(mockAudioSourceID(), "Mock audio device", MediaStreamSource::Audio));
+    mockSource2->m_capabilities = MediaStreamSourceCapabilities::create();
+    mockSource2->m_capabilities->setSourceId(mockSource2->id());
+    mockSource2->m_capabilities->setVolumeRange(MediaStreamSourceCapabilityRange(0UL, 100UL, true));
+
+    mockSource2->m_currentStates.sourceType = MediaStreamSourceStates::Microphone;
+    mockSource2->m_currentStates.sourceId = mockSource2->id();
+    mockSource2->m_currentStates.volume = 50;
+    mockSourceMap().add(mockSource2->id(), mockSource2.release());
+}
+
+void MockMediaStreamCenter::registerMockMediaStreamCenter()
+{
+    DEFINE_STATIC_LOCAL(MockMediaStreamCenter, center, ());
+    static bool registered = false;
+    if (!registered) {
+        registered = true;
+        MediaStreamCenter::setSharedStreamCenter(&center);
+        initializeMockSources();
+    }
+}
+
 static bool isSupportedMockConstraint(const String& constraintName)
 {
     return notFound != constraintName.find("_and_supported_");
@@ -75,16 +160,6 @@ static String verifyConstraints(MediaConstraints* constraints)
     return emptyString();
 }
 
-void MockMediaStreamCenter::registerMockMediaStreamCenter()
-{
-    DEFINE_STATIC_LOCAL(MockMediaStreamCenter, center, ());
-    static bool registered = false;
-    if (!registered) {
-        registered = true;
-        MediaStreamCenter::setSharedStreamCenter(&center);
-    }
-}
-
 void MockMediaStreamCenter::validateRequestConstraints(PassRefPtr<MediaStreamCreationClient> prpQueryClient, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints)
 {
     RefPtr<MediaStreamCreationClient> client = prpQueryClient;
@@ -118,6 +193,7 @@ void MockMediaStreamCenter::createMediaStream(PassRefPtr<MediaStreamCreationClie
     
     Vector<RefPtr<MediaStreamSource>> audioSources;
     Vector<RefPtr<MediaStreamSource>> videoSources;
+    MockSourceMap& map = mockSourceMap();
 
     if (audioConstraints) {
         String invalidQuery = verifyConstraints(audioConstraints.get());
@@ -127,7 +203,11 @@ void MockMediaStreamCenter::createMediaStream(PassRefPtr<MediaStreamCreationClie
         }
 
         if (audioConstraints) {
-            RefPtr<MediaStreamSource> audioSource = MediaStreamSource::create(emptyString(), MediaStreamSource::Audio, "Mock audio device");
+            MockSourceMap::iterator it = map.find(mockAudioSourceID());
+            ASSERT(it != map.end());
+
+            RefPtr<MediaStreamSource> audioSource = it->value;
+            audioSource->reset();
             audioSource->setReadyState(MediaStreamSource::Live);
             audioSources.append(audioSource.release());
         }
@@ -141,7 +221,11 @@ void MockMediaStreamCenter::createMediaStream(PassRefPtr<MediaStreamCreationClie
         }
 
         if (videoConstraints) {
-            RefPtr<MediaStreamSource> videoSource = MediaStreamSource::create(emptyString(), MediaStreamSource::Video, "Mock video device");
+            MockSourceMap::iterator it = map.find(mockVideoSourceID());
+            ASSERT(it != map.end());
+
+            RefPtr<MediaStreamSource> videoSource = it->value;
+            videoSource->reset();
             videoSource->setReadyState(MediaStreamSource::Live);
             videoSources.append(videoSource.release());
         }
@@ -153,39 +237,20 @@ void MockMediaStreamCenter::createMediaStream(PassRefPtr<MediaStreamCreationClie
 bool MockMediaStreamCenter::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient> prpClient)
 {
     RefPtr<MediaStreamTrackSourcesRequestClient> requestClient = prpClient;
-    Vector<RefPtr<TrackSourceInfo>> sources(2);
+    Vector<RefPtr<TrackSourceInfo>> sources;
 
-    sources[0] = TrackSourceInfo::create("Mock_audio_device_ID", TrackSourceInfo::Audio, "Mock audio device");
-    sources[1] = TrackSourceInfo::create("Mock_video_device_ID", TrackSourceInfo::Video, "Mock video device");
-
-    requestClient->didCompleteRequest(sources);
-    return true;
-}
+    MockSourceMap& map = mockSourceMap();
+    MockSourceMap::iterator end = map.end();
+    for (MockSourceMap::iterator it = map.begin(); it != end; ++it) {
+        MockSource* source = it->value.get();
 
-void MockMediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamSource* source)
-{
-    source->setReadyState(MediaStreamSource::Live);
-}
-
-bool MockMediaStreamCenter::didAddMediaStreamTrack(MediaStreamSource*)
-{
-    return true;
-}
+        sources.append(TrackSourceInfo::create(source->id(), source->type() == MediaStreamSource::Video ? TrackSourceInfo::Video : TrackSourceInfo::Audio, source->name()));
+    }
 
-bool MockMediaStreamCenter::didRemoveMediaStreamTrack(MediaStreamSource*)
-{
+    requestClient->didCompleteRequest(sources);
     return true;
 }
 
-void MockMediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
-{
-    endLocalMediaStream(stream);
-}
-
-void MockMediaStreamCenter::didCreateMediaStream(MediaStreamDescriptor*)
-{
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 21cc48f..da2a3e0 100644 (file)
@@ -40,11 +40,6 @@ public:
     virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
     virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) OVERRIDE;
-    virtual void didSetMediaStreamTrackEnabled(MediaStreamSource*) OVERRIDE;
-    virtual bool didAddMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual bool didRemoveMediaStreamTrack(MediaStreamSource*) OVERRIDE;
-    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
-    virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
 
 private:
     MockMediaStreamCenter() { }