<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192365] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192365">192365</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-12 10:03:08 -0800 (Thu, 12 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[MediaStream] Reflect media stream tracks as HTMLMediaElement tracks
https://bugs.webkit.org/show_bug.cgi?id=151145
Reviewed by Jer Noble.
Source/WebCore:
Test: fast/mediastream/MediaStream-video-element.html
* WebCore.xcodeproj/project.pbxproj: Add new header files.
* html/track/AudioTrack.h: Add comments to clean things up slightly.
* html/track/VideoTrack.h: Ditto.
Create a AudioTrackPrivateMediaStream or VideoTrackPrivateMediaStream for each track in
the MediaStream.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Call updateTracks.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didAddTrack): Ditto.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didRemoveTrack): Ditto.
(WebCore::updateTracksOfType): New, template function to update audio or video tracks.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): New.
* platform/mediastream/AudioTrackPrivateMediaStream.h: Added.
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::currentFrameImage): Fix a typo, early return if the track is
not active OR there is no active video track.
* platform/mediastream/MediaStreamPrivate.h:
(WebCore::MediaStreamPrivate::activeVideoTrack): Accessor for active video track, if any.
* platform/mediastream/VideoTrackPrivateMediaStream.h: Added.
* platform/mediastream/mac/AVAudioCaptureSource.mm:
(WebCore::AVAudioCaptureSource::updateStates): Set current states.
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::states): Set source ID.
(WebCore::AVMediaCaptureSource::capabilities): Set source ID directly.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
(WebCore::AVVideoCaptureSource::updateStates): Set states here instead of in the constructor.
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::capabilities): Set source ID directly.
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::updateStates): Set source type.
LayoutTests:
* fast/mediastream/MediaStream-video-element-expected.txt: Added.
* fast/mediastream/MediaStream-video-element.html: Added.
* fast/mediastream/resources/getUserMedia-helper.js: Return early on error.
* platform/gtk/TestExpectations: Skip new test.
* platform/ios-simulator/TestExpectations: Ditto.
* platform/mac-wk2/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamresourcesgetUserMediahelperjs">trunk/LayoutTests/fast/mediastream/resources/getUserMedia-helper.js</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmltrackAudioTrackh">trunk/Source/WebCore/html/track/AudioTrack.h</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVideoTrackh">trunk/Source/WebCore/html/track/VideoTrack.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVAudioCaptureSourcemm">trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVMediaCaptureSourcemm">trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm">trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmockMockRealtimeMediaSourcecpp">trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmockMockRealtimeVideoSourcecpp">trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmediastreamMediaStreamvideoelementexpectedtxt">trunk/LayoutTests/fast/mediastream/MediaStream-video-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamMediaStreamvideoelementhtml">trunk/LayoutTests/fast/mediastream/MediaStream-video-element.html</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamh">trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamVideoTrackPrivateMediaStreamh">trunk/Source/WebCore/platform/mediastream/VideoTrackPrivateMediaStream.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/ChangeLog        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-11-12 Eric Carlson <eric.carlson@apple.com>
+
+ [MediaStream] Reflect media stream tracks as HTMLMediaElement tracks
+ https://bugs.webkit.org/show_bug.cgi?id=151145
+
+ Reviewed by Jer Noble.
+
+ * fast/mediastream/MediaStream-video-element-expected.txt: Added.
+ * fast/mediastream/MediaStream-video-element.html: Added.
+ * fast/mediastream/resources/getUserMedia-helper.js: Return early on error.
+ * platform/gtk/TestExpectations: Skip new test.
+ * platform/ios-simulator/TestExpectations: Ditto.
+ * platform/mac-wk2/TestExpectations: Ditto.
+ * platform/win/TestExpectations: Ditto.
+
</ins><span class="cx"> 2015-11-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> XHR abort() event firing does not match spec
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamMediaStreamvideoelementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/MediaStream-video-element-expected.txt (0 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element-expected.txt        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+Tests MediaStreamTrack callbacks.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+
+**** calling mediaDevices.getUserMedia() ****
+PASS mediaDevices.getUserMedia succeeded.
+
+**** setup video element ****
+video.src = window.URL.createObjectURL(mediaStream)
+Event 'loadedmetadata'
+Event 'loadeddata'
+Event 'canplay'
+
+*** start playback ****
+video.play()
+Event 'play'
+Event 'canplaythrough'
+video.pause()
+
+**** check video element ****
+PASS video.videoWidth is 640
+PASS video.videoHeight is 480
+PASS video.src.indexOf("blob:") is 0
+PASS video.srcObject is mediaStream
+
+**** check video tracks ****
+PASS video.videoTracks.length is 1
+PASS video.videoTracks[0].id is mediaStream.getVideoTracks()[0].id
+video.videoTracks[0] properties:
+ track.kind = main
+ track.language =
+ track.id = <UUID>
+ track.label = Mock video device
+ track.selected = true
+ track.sourceBuffer = null
+
+**** check audio tracks ****
+PASS video.audioTracks.length is 1
+PASS video.audioTracks[0].id is mediaStream.getAudioTracks()[0].id
+video.audioTracks[0] properties:
+ track.kind = main
+ track.language =
+ track.id = <UUID>
+ track.label = Mock audio device
+ track.enabled = true
+ track.sourceBuffer = null
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamMediaStreamvideoelementhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/mediastream/MediaStream-video-element.html (0 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/MediaStream-video-element.html         (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-video-element.html        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <script src="../../resources/js-test-pre.js"></script>
+ <script>
+ var video;
+ var mediaStream;
+
+ function logEvent(element, eventName, func)
+ {
+ function _eventCallback(evt)
+ {
+ debug(`Event <em>'${evt.type}'</em>`);
+ if (func)
+ func(evt);
+ }
+ element.addEventListener(eventName, _eventCallback, true);
+ }
+
+ function limitPrecision(value, precision)
+ {
+ if (typeof value === "number" && value % 1 != 0)
+ return value.toFixed(precision);
+ return value;
+ }
+
+ function enumerateProperties(object, workFunc)
+ {
+ for (var property in object) {
+ // When https://webkit.org/b/129375 is fixed, we have to remove
+ // states.hasOwnProperty(property), because all the attributes
+ // will be in the prototype chain.
+ if (!object.hasOwnProperty(property) && !object.__proto__.hasOwnProperty(property))
+ continue;
+ if (object[property] === undefined)
+ continue;
+
+ if (typeof object[property] === "function")
+ workFunc(property, "[native function]");
+ else
+ workFunc(property, limitPrecision(object[property], 2));
+ }
+ }
+
+ function checkElementTrack(track)
+ {
+ enumerateProperties(track, function(property, value) {
+ if (property == "id")
+ value = "&lt;UUID>";
+ debug(` track.${property} = ${value}`);
+ });
+ }
+
+ function checkVideoElement()
+ {
+ evalAndLog("video.pause()");
+
+ debug("<br>**** check video element ****");
+ shouldBe('video.videoWidth', '640');
+ shouldBe('video.videoHeight', '480');
+ shouldBe('video.src.indexOf("blob:")', '0');
+ shouldBe('video.srcObject', 'mediaStream');
+
+ debug("<br>**** check video tracks ****");
+ shouldBe('video.videoTracks.length', '1');
+ shouldBe('video.videoTracks[0].id', 'mediaStream.getVideoTracks()[0].id');
+
+ debug("video.videoTracks[0] properties:");
+ checkElementTrack(video.videoTracks[0]);
+
+ debug("<br>**** check audio tracks ****");
+ shouldBe('video.audioTracks.length', '1');
+ shouldBe('video.audioTracks[0].id', 'mediaStream.getAudioTracks()[0].id');
+
+ debug("video.audioTracks[0] properties:");
+ checkElementTrack(video.audioTracks[0]);
+
+ debug("");
+ finishJSTest();
+ }
+
+ function canplay()
+ {
+ debug("<br>*** start playback ****");
+ evalAndLog("video.play()");
+ setTimeout(checkVideoElement, 100);
+ }
+
+ function setupStream(stream)
+ {
+ mediaStream = stream;
+ testPassed('mediaDevices.getUserMedia succeeded.');
+
+ debug("<br>**** setup video element ****");
+ evalAndLog("video.src = window.URL.createObjectURL(mediaStream)");
+ }
+
+ function start()
+ {
+ description("Tests MediaStreamTrack callbacks.");
+ video = document.querySelector('video');
+ logEvent(video, 'loadedmetadata')
+ logEvent(video, 'canplay', canplay)
+ logEvent(video, 'canplaythrough')
+ logEvent(video, 'loadeddata')
+ logEvent(video, 'play')
+
+ debug("<br>**** calling mediaDevices.getUserMedia() ****");
+ if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+ navigator.mediaDevices.getUserMedia( {video: true, audio: true} )
+ .then(setupStream)
+ .catch(function(reason) {
+ debug(`Stream generation failed with error: ${reason}`);
+ });
+ }
+
+ window.jsTestIsAsync = true;
+ window.successfullyParsed = true;
+ </script>
+ </head>
+ <body onload="start()">
+ <p id="description"></p>
+ <video controls width="680" height="360"></video>
+ <div id="console"></div>
+ <script src="../../resources/js-test-post.js"></script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamresourcesgetUserMediahelperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/mediastream/resources/getUserMedia-helper.js (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/resources/getUserMedia-helper.js        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/fast/mediastream/resources/getUserMedia-helper.js        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -4,9 +4,13 @@
</span><span class="cx"> else {
</span><span class="cx"> debug("This test can not be run without the testRunner");
</span><span class="cx"> finishJSTest();
</span><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- navigator.mediaDevices.getUserMedia(constraints).then(successCallback, reject).catch(defaultRejectOrCatch);
</del><ins>+ navigator.mediaDevices
+ .getUserMedia(constraints)
+ .then(successCallback, reject)
+ .catch(defaultRejectOrCatch);
</ins><span class="cx">
</span><span class="cx"> function reject(e) {
</span><span class="cx"> if (errorCallback)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -2572,4 +2572,7 @@
</span><span class="cx"> # Mocking the system language is not implemented in GTK.
</span><span class="cx"> fast/text/international/system-language [ Failure ]
</span><span class="cx">
</span><ins>+# HTMLMediaElement can not use a MediaStream as source.
+fast/mediastream/MediaStream-video-element.html [ Skip ]
+
</ins><span class="cx"> webkit.org/b/149128 fast/text/control-characters [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -2826,3 +2826,6 @@
</span><span class="cx"> imported/blink/svg/text/tspan-outline-crash.html [ ImageOnlyFailure Pass ]
</span><span class="cx"> imported/blink/transitions/transition-shape-outside-crash.html [ Pass Timeout ]
</span><span class="cx"> imported/blink/webexposed/webkit-focus-ring-exposed-to-quirks-mode.html [ ImageOnlyFailure ]
</span><ins>+
+# HTMLMediaElement can not use a MediaStream as source.
+fast/mediastream/MediaStream-video-element.html [ Skip ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -551,6 +551,9 @@
</span><span class="cx"> # WebKit1-only failure.
</span><span class="cx"> webkit.org/b/103857 fast/events/mouse-cursor-change.html [ Pass ]
</span><span class="cx">
</span><ins>+# HTMLMediaElement can not use a MediaStream as source.
+fast/mediastream/MediaStream-video-element.html [ Skip ]
+
</ins><span class="cx"> # Imported Blink tests which have not been investigated. Partially covered with rdar://problem/23023848.
</span><span class="cx"> imported/blink/fast/media/empty-media-rule.html [ Pass ImageOnlyFailure ]
</span><span class="cx"> imported/blink/fast/multicol/basic-rtl.html [ Pass ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/LayoutTests/platform/win/TestExpectations        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -3302,4 +3302,7 @@
</span><span class="cx">
</span><span class="cx"> webkit.org/b/150946 [ Debug ] scrollbars/custom-scrollbar-appearance-property.html [ Crash ]
</span><span class="cx">
</span><ins>+# HTMLMediaElement can not use a MediaStream as source.
+fast/mediastream/MediaStream-video-element.html [ Skip ]
+
</ins><span class="cx"> webkit.org/b/150948 [ Debug ] imported/blink/transitions/unprefixed-transform.html [ Pass Failure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/ChangeLog        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2015-11-12 Eric Carlson <eric.carlson@apple.com>
+
+ [MediaStream] Reflect media stream tracks as HTMLMediaElement tracks
+ https://bugs.webkit.org/show_bug.cgi?id=151145
+
+ Reviewed by Jer Noble.
+
+ Test: fast/mediastream/MediaStream-video-element.html
+
+ * WebCore.xcodeproj/project.pbxproj: Add new header files.
+
+ * html/track/AudioTrack.h: Add comments to clean things up slightly.
+ * html/track/VideoTrack.h: Ditto.
+
+ Create a AudioTrackPrivateMediaStream or VideoTrackPrivateMediaStream for each track in
+ the MediaStream.
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Call updateTracks.
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didAddTrack): Ditto.
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didRemoveTrack): Ditto.
+ (WebCore::updateTracksOfType): New, template function to update audio or video tracks.
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): New.
+
+ * platform/mediastream/AudioTrackPrivateMediaStream.h: Added.
+
+ * platform/mediastream/MediaStreamPrivate.cpp:
+ (WebCore::MediaStreamPrivate::currentFrameImage): Fix a typo, early return if the track is
+ not active OR there is no active video track.
+ * platform/mediastream/MediaStreamPrivate.h:
+ (WebCore::MediaStreamPrivate::activeVideoTrack): Accessor for active video track, if any.
+
+ * platform/mediastream/VideoTrackPrivateMediaStream.h: Added.
+
+ * platform/mediastream/mac/AVAudioCaptureSource.mm:
+ (WebCore::AVAudioCaptureSource::updateStates): Set current states.
+
+ * platform/mediastream/mac/AVMediaCaptureSource.mm:
+ (WebCore::AVMediaCaptureSource::states): Set source ID.
+ (WebCore::AVMediaCaptureSource::capabilities): Set source ID directly.
+
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
+ (WebCore::AVVideoCaptureSource::updateStates): Set states here instead of in the constructor.
+
+ * platform/mock/MockRealtimeMediaSource.cpp:
+ (WebCore::MockRealtimeMediaSource::capabilities): Set source ID directly.
+
+ * platform/mock/MockRealtimeVideoSource.cpp:
+ (WebCore::MockRealtimeVideoSource::updateStates): Set source type.
+
</ins><span class="cx"> 2015-11-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> XHR abort() event firing does not match spec
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -121,6 +121,7 @@
</span><span class="cx">                 0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; };
</span><span class="cx">                 070E09191875EEFC003A1D3C /* PlatformMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E09181875ED93003A1D3C /* PlatformMediaSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 070E091B1875EF71003A1D3C /* PlatformMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070E091A1875EF71003A1D3C /* PlatformMediaSession.cpp */; };
</span><ins>+                070E81D11BF27656001FDA48 /* VideoTrackPrivateMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E81D01BF27656001FDA48 /* VideoTrackPrivateMediaStream.h */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 070F549817F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */; };
</span><span class="cx">                 070F549E17F2402700169E04 /* AudioDestinationConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549D17F2402700169E04 /* AudioDestinationConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 0711589117DF6F6600EDFE2B /* MediaStreamPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */; };
</span><span class="lines">@@ -343,6 +344,7 @@
</span><span class="cx">                 07D6A4F01BECF2D200174146 /* MockRealtimeMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6A4EE1BECF2D200174146 /* MockRealtimeMediaSource.h */; };
</span><span class="cx">                 07D6A4F31BED5F8800174146 /* MockRealtimeAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07D6A4F11BED5F8800174146 /* MockRealtimeAudioSource.cpp */; };
</span><span class="cx">                 07D6A4F41BED5F8800174146 /* MockRealtimeAudioSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6A4F21BED5F8800174146 /* MockRealtimeAudioSource.h */; };
</span><ins>+                 07D6A4F81BF2307D00174146 /* AudioTrackPrivateMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6A4F61BF2307D00174146 /* AudioTrackPrivateMediaStream.h */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 07DC5FD417D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */; };
</span><span class="cx">                 07E116B11489C9A100EC5ACE /* JSTextTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */; };
</span><span class="cx">                 07E117071489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */; };
</span><span class="lines">@@ -7359,6 +7361,7 @@
</span><span class="cx">                 070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mediaControls.css; sourceTree = "<group>"; };
</span><span class="cx">                 070E09181875ED93003A1D3C /* PlatformMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformMediaSession.h; sourceTree = "<group>"; };
</span><span class="cx">                 070E091A1875EF71003A1D3C /* PlatformMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformMediaSession.cpp; sourceTree = "<group>"; };
</span><ins>+                070E81D01BF27656001FDA48 /* VideoTrackPrivateMediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackPrivateMediaStream.h; sourceTree = "<group>"; };
</ins><span class="cx">                 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamConstraintsValidationClient.h; sourceTree = "<group>"; };
</span><span class="cx">                 070F549D17F2402700169E04 /* AudioDestinationConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDestinationConsumer.h; sourceTree = "<group>"; };
</span><span class="cx">                 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamPrivate.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -7616,6 +7619,7 @@
</span><span class="cx">                 07D6A4EE1BECF2D200174146 /* MockRealtimeMediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeMediaSource.h; sourceTree = "<group>"; };
</span><span class="cx">                 07D6A4F11BED5F8800174146 /* MockRealtimeAudioSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockRealtimeAudioSource.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 07D6A4F21BED5F8800174146 /* MockRealtimeAudioSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeAudioSource.h; sourceTree = "<group>"; };
</span><ins>+                07D6A4F61BF2307D00174146 /* AudioTrackPrivateMediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioTrackPrivateMediaStream.h; path = platform/mediastream/AudioTrackPrivateMediaStream.h; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCStatsResponseCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCueCustom.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -15213,6 +15217,7 @@
</span><span class="cx">                 07221B9217CF0AD400848E51 /* mediastream */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                07D6A4F61BF2307D00174146 /* AudioTrackPrivateMediaStream.h */,
</ins><span class="cx">                                 0729B14D17CFCCA0004F1D60 /* mac */,
</span><span class="cx">                                 07221B9917CF0AD400848E51 /* MediaConstraints.h */,
</span><span class="cx">                                 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */,
</span><span class="lines">@@ -15246,6 +15251,7 @@
</span><span class="cx">                                 07221BAE17CF0AD400848E51 /* RTCStatsRequest.h */,
</span><span class="cx">                                 07221BAF17CF0AD400848E51 /* RTCStatsResponseBase.h */,
</span><span class="cx">                                 07221BB017CF0AD400848E51 /* RTCVoidRequest.h */,
</span><ins>+                                070E81D01BF27656001FDA48 /* VideoTrackPrivateMediaStream.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = mediastream;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -25637,6 +25643,7 @@
</span><span class="cx">                                 26EA89A71B4F2B75008C5FD2 /* HashableActionList.h in Headers */,
</span><span class="cx">                                 8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */,
</span><span class="cx">                                 A8748BE012CBF2DC001FBA41 /* HashTools.h in Headers */,
</span><ins>+                                07D6A4F81BF2307D00174146 /* AudioTrackPrivateMediaStream.h in Headers */,
</ins><span class="cx">                                 F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */,
</span><span class="cx">                                 51A9D9F4195B9503001B2B5C /* HIDGamepad.h in Headers */,
</span><span class="cx">                                 5179CE37195CAC7E0019C198 /* HIDGamepadProvider.h in Headers */,
</span><span class="lines">@@ -26896,6 +26903,7 @@
</span><span class="cx">                                 8AF4E55611DC5A36000ED3DE /* PerformanceNavigation.h in Headers */,
</span><span class="cx">                                 86512EDF154A2AEF00A90426 /* PerformanceResourceTiming.h in Headers */,
</span><span class="cx">                                 8AF4E55C11DC5A63000ED3DE /* PerformanceTiming.h in Headers */,
</span><ins>+                                070E81D11BF27656001FDA48 /* VideoTrackPrivateMediaStream.h in Headers */,
</ins><span class="cx">                                 FD581FB51520F93B003A7A75 /* PeriodicWave.h in Headers */,
</span><span class="cx">                                 49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
</span><span class="cx">                                 51B454EA1B4DAE7D0085EAA6 /* PingHandle.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackAudioTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/AudioTrack.h (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/AudioTrack.h        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/html/track/AudioTrack.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -79,12 +79,15 @@
</span><span class="cx"> private:
</span><span class="cx"> virtual bool isValidKind(const AtomicString&) const override;
</span><span class="cx">
</span><del>- virtual void enabledChanged(AudioTrackPrivate*, bool) override;
- virtual void idChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void labelChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void languageChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void willRemove(TrackPrivateBase*) override;
</del><ins>+ // AudioTrackPrivateClient
+ void enabledChanged(AudioTrackPrivate*, bool) override;
</ins><span class="cx">
</span><ins>+ // TrackPrivateBaseClient
+ void idChanged(TrackPrivateBase*, const AtomicString&) override;
+ void labelChanged(TrackPrivateBase*, const AtomicString&) override;
+ void languageChanged(TrackPrivateBase*, const AtomicString&) override;
+ void willRemove(TrackPrivateBase*) override;
+
</ins><span class="cx"> void updateKindFromPrivate();
</span><span class="cx">
</span><span class="cx"> bool m_enabled;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVideoTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VideoTrack.h (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VideoTrack.h        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/html/track/VideoTrack.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -85,12 +85,15 @@
</span><span class="cx"> private:
</span><span class="cx"> virtual bool isValidKind(const AtomicString&) const override;
</span><span class="cx">
</span><del>- virtual void selectedChanged(VideoTrackPrivate*, bool) override;
- virtual void idChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void labelChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void languageChanged(TrackPrivateBase*, const AtomicString&) override;
- virtual void willRemove(TrackPrivateBase*) override;
</del><ins>+ // VideoTrackPrivateClient
+ void selectedChanged(VideoTrackPrivate*, bool) override;
</ins><span class="cx">
</span><ins>+ // TrackPrivateBaseClient
+ void idChanged(TrackPrivateBase*, const AtomicString&) override;
+ void labelChanged(TrackPrivateBase*, const AtomicString&) override;
+ void languageChanged(TrackPrivateBase*, const AtomicString&) override;
+ void willRemove(TrackPrivateBase*) override;
+
</ins><span class="cx"> virtual bool enabled() const override { return selected(); }
</span><span class="cx">
</span><span class="cx"> void updateKindFromPrivate();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -40,9 +40,11 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class AudioTrackPrivateMediaStream;
</ins><span class="cx"> class AVVideoCaptureSource;
</span><span class="cx"> class Clock;
</span><span class="cx"> class MediaSourcePrivateClient;
</span><ins>+class VideoTrackPrivateMediaStream;
</ins><span class="cx">
</span><span class="cx"> class MediaPlayerPrivateMediaStreamAVFObjC : public MediaPlayerPrivateInterface, public MediaStreamPrivate::Observer {
</span><span class="cx"> public:
</span><span class="lines">@@ -138,14 +140,17 @@
</span><span class="cx"> RenderingModeStatus updateIntrinsicSize(const FloatSize&);
</span><span class="cx">
</span><span class="cx"> void createPreviewLayers();
</span><del>-
</del><span class="cx"> void setPausedImageVisible(bool);
</span><span class="cx">
</span><ins>+ void updateTracks();
+
</ins><span class="cx"> void scheduleDeferredTask(std::function<void()>);
</span><span class="cx">
</span><span class="cx"> // MediaStreamPrivate::Observer
</span><span class="cx"> void activeStatusChanged() override;
</span><span class="cx"> void characteristicsChanged() override;
</span><ins>+ void didAddTrack(MediaStreamTrackPrivate&) override;
+ void didRemoveTrack(MediaStreamTrackPrivate&) override;
</ins><span class="cx">
</span><span class="cx"> MediaPlayer* m_player { nullptr };
</span><span class="cx"> WeakPtrFactory<MediaPlayerPrivateMediaStreamAVFObjC> m_weakPtrFactory;
</span><span class="lines">@@ -154,6 +159,10 @@
</span><span class="cx"> mutable RetainPtr<PlatformLayer> m_videoBackgroundLayer;
</span><span class="cx"> RetainPtr<CGImageRef> m_pausedImage;
</span><span class="cx"> std::unique_ptr<Clock> m_clock;
</span><ins>+
+ HashMap<String, RefPtr<AudioTrackPrivateMediaStream>> m_audioTrackMap;
+ HashMap<String, RefPtr<VideoTrackPrivateMediaStream>> m_videoTrackMap;
+
</ins><span class="cx"> MediaPlayer::NetworkState m_networkState { MediaPlayer::Empty };
</span><span class="cx"> MediaPlayer::ReadyState m_readyState { MediaPlayer::HaveNothing };
</span><span class="cx"> FloatSize m_intrinsicSize;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -30,10 +30,12 @@
</span><span class="cx">
</span><span class="cx"> #import "AVAudioCaptureSource.h"
</span><span class="cx"> #import "AVVideoCaptureSource.h"
</span><ins>+#import "AudioTrackPrivateMediaStream.h"
</ins><span class="cx"> #import "Clock.h"
</span><span class="cx"> #import "GraphicsContext.h"
</span><span class="cx"> #import "Logging.h"
</span><span class="cx"> #import "MediaStreamPrivate.h"
</span><ins>+#import "VideoTrackPrivateMediaStream.h"
</ins><span class="cx"> #import <QuartzCore/CALayer.h>
</span><span class="cx"> #import <QuartzCore/CATransaction.h>
</span><span class="cx"> #import <objc_runtime.h>
</span><span class="lines">@@ -128,6 +130,7 @@
</span><span class="cx"> m_ended = !m_mediaStreamPrivate->active();
</span><span class="cx">
</span><span class="cx"> scheduleDeferredTask([this] {
</span><ins>+ updateTracks();
</ins><span class="cx"> setNetworkState(MediaPlayer::Idle);
</span><span class="cx"> updateReadyState();
</span><span class="cx"> });
</span><span class="lines">@@ -381,6 +384,8 @@
</span><span class="cx"> sizeChanged = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ updateTracks();
+
</ins><span class="cx"> if (m_waitingForNewFrame && m_mediaStreamPrivate->isProducingData())
</span><span class="cx"> setPausedImageVisible(false);
</span><span class="cx">
</span><span class="lines">@@ -399,6 +404,79 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MediaPlayerPrivateMediaStreamAVFObjC::didAddTrack(MediaStreamTrackPrivate&)
+{
+ updateTracks();
+}
+
+void MediaPlayerPrivateMediaStreamAVFObjC::didRemoveTrack(MediaStreamTrackPrivate&)
+{
+ updateTracks();
+}
+
+template <typename RefT, typename PassRefT>
+void updateTracksOfType(HashMap<String, RefT>& trackMap, RealtimeMediaSource::Type trackType, MediaStreamTrackPrivateVector& currentTracks, RefT (*itemFactory)(MediaStreamTrackPrivate&), MediaPlayer* player, void (MediaPlayer::*removedFunction)(PassRefT), void (MediaPlayer::*addedFunction)(PassRefT), std::function<void(RefT, int)> configureCallback)
+{
+ Vector<RefT> removedTracks;
+ Vector<RefT> addedTracks;
+ Vector<RefPtr<MediaStreamTrackPrivate>> addedPrivateTracks;
+
+ for (const auto& track : currentTracks) {
+ if (track->type() != trackType)
+ continue;
+
+ if (!trackMap.contains(track->id()))
+ addedPrivateTracks.append(track);
+ }
+
+ for (const auto& track : trackMap.values()) {
+ MediaStreamTrackPrivate* streamTrack = track->streamTrack();
+ if (currentTracks.contains(streamTrack))
+ continue;
+
+ removedTracks.append(track);
+ trackMap.remove(streamTrack->id());
+ }
+
+ for (auto& track : addedPrivateTracks) {
+ RefT newTrack = itemFactory(*track.get());
+ trackMap.add(track->id(), newTrack);
+ addedTracks.append(newTrack);
+ }
+
+ int index = 0;
+ for (const auto& track : trackMap.values())
+ configureCallback(track, index++);
+
+ for (auto& track : removedTracks)
+ (player->*removedFunction)(track);
+
+ for (auto& track : addedTracks)
+ (player->*addedFunction)(track);
+}
+
+void MediaPlayerPrivateMediaStreamAVFObjC::updateTracks()
+{
+ Vector<RefPtr<TrackPrivateBase>> removedTracks;
+ Vector<RefPtr<MediaStreamTrackPrivate>> addedTracks;
+
+ MediaStreamTrackPrivateVector currentTracks = m_mediaStreamPrivate->tracks();
+
+ std::function<void(RefPtr<AudioTrackPrivateMediaStream>, int)> enableAudioTrack = [this](RefPtr<AudioTrackPrivateMediaStream> track, int index)
+ {
+ track->setTrackIndex(index);
+ track->setEnabled(track->streamTrack()->enabled() && !track->streamTrack()->muted());
+ };
+ updateTracksOfType(m_audioTrackMap, RealtimeMediaSource::Audio, currentTracks, &AudioTrackPrivateMediaStream::create, m_player, &MediaPlayer::removeAudioTrack, &MediaPlayer::addAudioTrack, enableAudioTrack);
+
+ std::function<void(RefPtr<VideoTrackPrivateMediaStream>, int)> enableVideoTrack = [this](RefPtr<VideoTrackPrivateMediaStream> track, int index)
+ {
+ track->setTrackIndex(index);
+ track->setSelected(track->streamTrack() == m_mediaStreamPrivate->activeVideoTrack());
+ };
+ updateTracksOfType(m_videoTrackMap, RealtimeMediaSource::Video, currentTracks, &VideoTrackPrivateMediaStream::create, m_player, &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack, enableVideoTrack);
+}
+
</ins><span class="cx"> std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateMediaStreamAVFObjC::seekable() const
</span><span class="cx"> {
</span><span class="cx"> return std::make_unique<PlatformTimeRanges>();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamAudioTrackPrivateMediaStreamh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h (0 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h         (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/AudioTrackPrivateMediaStream.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2015 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 AudioTrackPrivateMediaStream_h
+#define AudioTrackPrivateMediaStream_h
+
+#if ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
+
+#include "AudioTrackPrivate.h"
+#include "MediaStreamTrackPrivate.h"
+
+namespace WebCore {
+
+class AudioTrackPrivateMediaStream final : public AudioTrackPrivate {
+ WTF_MAKE_NONCOPYABLE(AudioTrackPrivateMediaStream)
+public:
+
+ static RefPtr<AudioTrackPrivateMediaStream> create(MediaStreamTrackPrivate& streamTrack)
+ {
+ return adoptRef(*new AudioTrackPrivateMediaStream(streamTrack));
+ }
+
+ virtual ~AudioTrackPrivateMediaStream() { }
+
+ Kind kind() const override { return Kind::Main; }
+ AtomicString id() const override { return m_id; }
+ AtomicString label() const override { return m_label; }
+ AtomicString language() const override { return emptyAtom; }
+ int trackIndex() const override { return m_index; }
+
+ void setTrackIndex(int index) { m_index = index; }
+
+ MediaStreamTrackPrivate* streamTrack() const { return m_streamTrack.get(); }
+
+private:
+ AudioTrackPrivateMediaStream(MediaStreamTrackPrivate& track)
+ : m_streamTrack(&track)
+ , m_id(track.id())
+ , m_label(track.label())
+ {
+ }
+
+ RefPtr<MediaStreamTrackPrivate> m_streamTrack;
+ AtomicString m_id;
+ AtomicString m_label;
+ int m_index { 0 };
+};
+
+}
+
+#endif // ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
+
+#endif // AudioTrackPrivateMediaStream_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> MediaStreamPrivate::currentFrameImage()
</span><span class="cx"> {
</span><del>- if (!active() && !m_activeVideoTrack)
</del><ins>+ if (!active() || !m_activeVideoTrack)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> return m_activeVideoTrack->source()->currentFrameImage();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx"> String id() const { return m_id; }
</span><span class="cx">
</span><span class="cx"> MediaStreamTrackPrivateVector tracks() const;
</span><ins>+ MediaStreamTrackPrivate* activeVideoTrack() { return m_activeVideoTrack; }
</ins><span class="cx">
</span><span class="cx"> bool active() const { return m_isActive; }
</span><span class="cx"> void updateActiveState(NotifyClientOption);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamVideoTrackPrivateMediaStreamh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/mediastream/VideoTrackPrivateMediaStream.h (0 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/VideoTrackPrivateMediaStream.h         (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/VideoTrackPrivateMediaStream.h        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2015 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. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 VideoTrackPrivateMediaStream_h
+#define VideoTrackPrivateMediaStream_h
+
+#if ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamTrackPrivate.h"
+#include "VideoTrackPrivate.h"
+
+namespace WebCore {
+
+class VideoTrackPrivateMediaStream final : public VideoTrackPrivate {
+ WTF_MAKE_NONCOPYABLE(VideoTrackPrivateMediaStream)
+public:
+
+ static RefPtr<VideoTrackPrivateMediaStream> create(MediaStreamTrackPrivate& streamTrack)
+ {
+ return adoptRef(*new VideoTrackPrivateMediaStream(streamTrack));
+ }
+
+ virtual ~VideoTrackPrivateMediaStream() { }
+
+ Kind kind() const override { return Kind::Main; }
+ AtomicString id() const override { return m_id; }
+ AtomicString label() const override { return m_label; }
+ AtomicString language() const override { return emptyAtom; }
+ int trackIndex() const override { return m_index; }
+
+ void setTrackIndex(int index) { m_index = index; }
+
+ MediaStreamTrackPrivate* streamTrack() const { return m_streamTrack.get(); }
+
+private:
+ VideoTrackPrivateMediaStream(MediaStreamTrackPrivate& track)
+ : m_streamTrack(&track)
+ , m_id(track.id())
+ , m_label(track.label())
+ {
+ }
+
+ RefPtr<MediaStreamTrackPrivate> m_streamTrack;
+ AtomicString m_id;
+ AtomicString m_label;
+ int m_index { 0 };
+};
+
+}
+
+#endif // ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
+
+#endif // VideoTrackPrivateMediaStream_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVAudioCaptureSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -88,6 +88,10 @@
</span><span class="cx"> void AVAudioCaptureSource::updateStates()
</span><span class="cx"> {
</span><span class="cx"> // FIXME: use [AVCaptureAudioPreviewOutput volume] for volume
</span><ins>+
+ RealtimeMediaSourceStates* states = currentStates();
+ states->setSourceId(id());
+ states->setSourceType(RealtimeMediaSourceStates::Microphone);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AVAudioCaptureSource::addObserver(AVAudioCaptureSource::Observer* observer)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVMediaCaptureSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -167,6 +167,7 @@
</span><span class="cx">
</span><span class="cx"> const RealtimeMediaSourceStates& AVMediaCaptureSource::states()
</span><span class="cx"> {
</span><ins>+ m_currentStates.setSourceId(id());
</ins><span class="cx"> updateStates();
</span><span class="cx"> return m_currentStates;
</span><span class="cx"> }
</span><span class="lines">@@ -175,7 +176,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (!m_capabilities) {
</span><span class="cx"> m_capabilities = RealtimeMediaSourceCapabilities::create();
</span><del>- m_capabilities->setSourceId(m_currentStates.sourceId());
</del><ins>+ m_capabilities->setSourceId(id());
</ins><span class="cx"> initializeCapabilities(*m_capabilities.get());
</span><span class="cx"> }
</span><span class="cx"> return m_capabilities;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -101,8 +101,6 @@
</span><span class="cx"> AVVideoCaptureSource::AVVideoCaptureSource(AVCaptureDeviceType* device, const AtomicString& id, PassRefPtr<MediaConstraints> constraint)
</span><span class="cx"> : AVMediaCaptureSource(device, id, RealtimeMediaSource::Video, constraint)
</span><span class="cx"> {
</span><del>- currentStates()->setSourceId(id);
- currentStates()->setSourceType(RealtimeMediaSourceStates::Camera);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> AVVideoCaptureSource::~AVVideoCaptureSource()
</span><span class="lines">@@ -120,6 +118,9 @@
</span><span class="cx"> {
</span><span class="cx"> RealtimeMediaSourceStates* states = currentStates();
</span><span class="cx">
</span><ins>+ states->setSourceId(id());
+ states->setSourceType(RealtimeMediaSourceStates::Camera);
+
</ins><span class="cx"> if ([device() position] == AVCaptureDevicePositionFront)
</span><span class="cx"> states->setFacingMode(RealtimeMediaSourceStates::User);
</span><span class="cx"> else if ([device() position] == AVCaptureDevicePositionBack)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMockRealtimeMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (!m_capabilities) {
</span><span class="cx"> m_capabilities = RealtimeMediaSourceCapabilities::create();
</span><del>- m_capabilities->setSourceId(m_currentStates.sourceId());
</del><ins>+ m_capabilities->setSourceId(id());
</ins><span class="cx"> initializeCapabilities(*m_capabilities.get());
</span><span class="cx"> }
</span><span class="cx"> return m_capabilities;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMockRealtimeVideoSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (192364 => 192365)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp        2015-11-12 17:54:58 UTC (rev 192364)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp        2015-11-12 18:03:08 UTC (rev 192365)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx"> {
</span><span class="cx"> RealtimeMediaSourceStates* states = currentStates();
</span><span class="cx">
</span><ins>+ states->setSourceType(RealtimeMediaSourceStates::Camera);
</ins><span class="cx"> states->setFacingMode(RealtimeMediaSourceStates::User);
</span><span class="cx"> states->setFrameRate(m_frameRate);
</span><span class="cx"> states->setWidth(m_size.width());
</span></span></pre>
</div>
</div>
</body>
</html>