Title: [159797] trunk
Revision
159797
Author
commit-qu...@webkit.org
Date
2013-11-26 18:13:04 -0800 (Tue, 26 Nov 2013)

Log Message

[MediaStream API] HTMLMediaElement should be able to use MediaStream as source
https://bugs.webkit.org/show_bug.cgi?id=121943

Patch by Nick Diego Yamane <nick.yam...@openbossa.org> on 2013-11-26
Reviewed by Eric Carlson.

Source/WebCore:

Implement MediaStream direct assignment to Media Elements using the new 'srcObject'
attribute: http://www.w3.org/TR/mediacapture-streams/#direct-assignment-to-media-elements

Test: fast/mediastream/MediaStream-MediaElement-srcObject.html

* CMakeLists.txt: Added new HTMLMediaElementMediaStream.h and .cpp to cmake build.
* DerivedSources.make: Added HTMLMediaElementMediaStream.idl.
* GNUmakefile.list.am: Added new HTMLMediaElementMediaStream* to autotools build.
* WebCore.xcodeproj/project.pbxproj: Added new files.
* Modules/mediastream/HTMLMediaElementMediaStream.cpp: Added.
(WebCore::HTMLMediaElementMediaStream::srcObject): implements srcObject getter.
(WebCore::HTMLMediaElementMediaStream::setSrcObject): implements srcObject setter.
* Modules/mediastream/HTMLMediaElementMediaStream.h: Added.
* Modules/mediastream/HTMLMediaElementMediaStream.idl: Added.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setSrcObject): This is an initial implementation, and
is still incomplete, that will be addressed in a separate bug: https://webkit.org/b/124896
* html/HTMLMediaElement.h: Added m_mediaStreamSrcObject class variable
and its corresponding getter.

Source/WebKit2:

Add mediastream module and platform to cmake include directories.

* CMakeLists.txt:

LayoutTests:

Add layout tests to MediaStream direct assignment to HTMLMediaElement
using brand new srcObject attribute.

* fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt: Added.
* fast/mediastream/MediaStream-MediaElement-srcObject.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (159796 => 159797)


--- trunk/LayoutTests/ChangeLog	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/LayoutTests/ChangeLog	2013-11-27 02:13:04 UTC (rev 159797)
@@ -1,3 +1,16 @@
+2013-11-26  Nick Diego Yamane  <nick.yam...@openbossa.org>
+
+        [MediaStream API] HTMLMediaElement should be able to use MediaStream as source
+        https://bugs.webkit.org/show_bug.cgi?id=121943
+
+        Reviewed by Eric Carlson.
+
+        Add layout tests to MediaStream direct assignment to HTMLMediaElement
+        using brand new srcObject attribute.
+
+        * fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt: Added.
+        * fast/mediastream/MediaStream-MediaElement-srcObject.html: Added.
+
 2013-11-26  Bear Travis  <betra...@adobe.com>
 
         [CSS Shapes] Layout using [<box> || <shape>] value

Added: trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt (0 => 159797)


--- trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt	2013-11-27 02:13:04 UTC (rev 159797)
@@ -0,0 +1,22 @@
+Tests MediaStream assignment to MediaElement using 'srcObject' MediaElement attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS navigator.webkitGetUserMedia({audio:true, video:false}, gotStream1, error); did not throw exception.
+PASS stream.getAudioTracks().length is 1
+PASS stream.getVideoTracks().length is 0
+PASS audio.srcObject = stream; did not throw exception.
+PASS streamObj = audio.srcObject; did not throw exception.
+PASS streamObj is stream
+PASS streamObj.getAudioTracks().length is 1
+PASS streamObj.getVideoTracks().length is 0
+PASS streamObj.id is stream.id
+PASS stream assigned to media element.
+PASS audio.srcObject = null; did not throw exception.
+PASS streamObj = audio.srcObject; did not throw exception.
+PASS streamObj is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html (0 => 159797)


--- trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html	2013-11-27 02:13:04 UTC (rev 159797)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <p id="description"></p>
+        <div id="console"></div>
+        <script>
+            description("Tests MediaStream assignment to MediaElement using 'srcObject' MediaElement attribute.");
+
+            var stream;
+            var errorArg;
+
+            function error()
+            {
+                testFailed('Error callback called.');
+                finishJSTest();
+            }
+
+            function testNullStreamObject(stream, audio)
+            {
+                shouldNotThrow("audio.srcObject = null;");
+                shouldNotThrow("streamObj = audio.srcObject;");
+                shouldBe('streamObj', 'null');
+                finishJSTest();
+            }
+
+            function gotStream(s)
+            {
+                stream = s;
+                shouldBe('stream.getAudioTracks().length', '1');
+                shouldBe('stream.getVideoTracks().length', '0');
+
+                audio = new Audio();
+                shouldNotThrow("audio.srcObject = stream;");
+                shouldNotThrow("streamObj = audio.srcObject;");
+                shouldBe('streamObj', 'stream');
+                shouldBe('streamObj.getAudioTracks().length', '1');
+                shouldBe('streamObj.getVideoTracks().length', '0');
+                shouldBe('streamObj.id', 'stream.id');
+                testPassed('stream assigned to media element.');
+
+                testNullStreamObject(stream, audio);
+            }
+
+            shouldNotThrow("navigator.webkitGetUserMedia({audio:true, video:false}, gotStream, error);");
+
+            window.jsTestIsAsync = true;
+            window.successfullyParsed = true;
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (159796 => 159797)


--- trunk/Source/WebCore/CMakeLists.txt	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-11-27 02:13:04 UTC (rev 159797)
@@ -189,6 +189,7 @@
     Modules/mediastream/AllVideoCapabilities.idl
     Modules/mediastream/AudioStreamTrack.idl
     Modules/mediastream/CapabilityRange.idl
+    Modules/mediastream/HTMLMediaElementMediaStream.idl
     Modules/mediastream/MediaSourceStates.idl
     Modules/mediastream/MediaStream.idl
     Modules/mediastream/MediaStreamCapabilities.idl
@@ -829,6 +830,7 @@
 
     Modules/mediastream/AudioStreamTrack.cpp
     Modules/mediastream/CapabilityRange.cpp
+    Modules/mediastream/HTMLMediaElementMediaStream.cpp
     Modules/mediastream/MediaConstraintsImpl.cpp
     Modules/mediastream/MediaSourceStates.cpp
     Modules/mediastream/MediaStream.cpp

Modified: trunk/Source/WebCore/ChangeLog (159796 => 159797)


--- trunk/Source/WebCore/ChangeLog	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/ChangeLog	2013-11-27 02:13:04 UTC (rev 159797)
@@ -1,3 +1,30 @@
+2013-11-26  Nick Diego Yamane  <nick.yam...@openbossa.org>
+
+        [MediaStream API] HTMLMediaElement should be able to use MediaStream as source
+        https://bugs.webkit.org/show_bug.cgi?id=121943
+
+        Reviewed by Eric Carlson.
+
+        Implement MediaStream direct assignment to Media Elements using the new 'srcObject'
+        attribute: http://www.w3.org/TR/mediacapture-streams/#direct-assignment-to-media-elements
+
+        Test: fast/mediastream/MediaStream-MediaElement-srcObject.html
+
+        * CMakeLists.txt: Added new HTMLMediaElementMediaStream.h and .cpp to cmake build.
+        * DerivedSources.make: Added HTMLMediaElementMediaStream.idl.
+        * GNUmakefile.list.am: Added new HTMLMediaElementMediaStream* to autotools build.
+        * WebCore.xcodeproj/project.pbxproj: Added new files.
+        * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Added.
+        (WebCore::HTMLMediaElementMediaStream::srcObject): implements srcObject getter.
+        (WebCore::HTMLMediaElementMediaStream::setSrcObject): implements srcObject setter.
+        * Modules/mediastream/HTMLMediaElementMediaStream.h: Added.
+        * Modules/mediastream/HTMLMediaElementMediaStream.idl: Added.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::setSrcObject): This is an initial implementation, and
+        is still incomplete, that will be addressed in a separate bug: https://webkit.org/b/124896
+        * html/HTMLMediaElement.h: Added m_mediaStreamSrcObject class variable
+        and its corresponding getter.
+
 2013-11-26  Andreas Kling  <akl...@apple.com>
 
         Use child iterator to find operators in RenderMathMLRow::layout().

Modified: trunk/Source/WebCore/DerivedSources.make (159796 => 159797)


--- trunk/Source/WebCore/DerivedSources.make	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/DerivedSources.make	2013-11-27 02:13:04 UTC (rev 159797)
@@ -106,6 +106,7 @@
 	$(WebCore)/Modules/mediastream/AllAudioCapabilities.idl \
 	$(WebCore)/Modules/mediastream/AudioStreamTrack.idl \
     $(WebCore)/Modules/mediastream/CapabilityRange.idl \
+    $(WebCore)/Modules/mediastream/HTMLMediaElementMediaStream.idl \
     $(WebCore)/Modules/mediastream/MediaSourceStates.idl \
 	$(WebCore)/Modules/mediastream/MediaStream.idl \
 	$(WebCore)/Modules/mediastream/MediaStreamCapabilities.idl \

Modified: trunk/Source/WebCore/GNUmakefile.list.am (159796 => 159797)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-11-27 02:13:04 UTC (rev 159797)
@@ -355,6 +355,8 @@
 	DerivedSources/WebCore/JSHTMLMarqueeElement.h \
 	DerivedSources/WebCore/JSHTMLMediaElement.cpp \
 	DerivedSources/WebCore/JSHTMLMediaElement.h \
+	DerivedSources/WebCore/JSHTMLMediaElementMediaStream.cpp \
+	DerivedSources/WebCore/JSHTMLMediaElementMediaStream.h \
 	DerivedSources/WebCore/JSHTMLMenuElement.cpp \
 	DerivedSources/WebCore/JSHTMLMenuElement.h \
 	DerivedSources/WebCore/JSHTMLMetaElement.cpp \
@@ -1887,6 +1889,8 @@
 	Source/WebCore/Modules/mediastream/AudioStreamTrack.h \
 	Source/WebCore/Modules/mediastream/CapabilityRange.cpp \
 	Source/WebCore/Modules/mediastream/CapabilityRange.h \
+	Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp \
+	Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h \
 	Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp \
 	Source/WebCore/Modules/mediastream/MediaConstraintsImpl.h \
 	Source/WebCore/Modules/mediastream/MediaSourceStates.cpp \

Added: trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp (0 => 159797)


--- trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp	2013-11-27 02:13:04 UTC (rev 159797)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS 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"
+#include "HTMLMediaElementMediaStream.h"
+
+#if ENABLE(MEDIA_STREAM) && ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+#include "MediaStream.h"
+
+namespace WebCore {
+
+MediaStream* HTMLMediaElementMediaStream::srcObject(HTMLMediaElement* mediaElement, bool& isNull)
+{
+    ASSERT(mediaElement);
+    return mediaElement->srcObject();
+}
+
+void HTMLMediaElementMediaStream::setSrcObject(HTMLMediaElement* mediaElement, MediaStream* mediaStream)
+{
+    ASSERT(mediaElement);
+    mediaElement->setSrcObject(mediaStream);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && ENABLE(VIDEO)

Added: trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h (0 => 159797)


--- trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h	2013-11-27 02:13:04 UTC (rev 159797)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS 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 HTMLMediaElementMediaStream_h
+#define HTMLMediaElementMediaStream_h
+
+#if ENABLE(MEDIA_STREAM) && ENABLE(VIDEO)
+
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class HTMLMediaElement;
+class MediaStream;
+
+class HTMLMediaElementMediaStream {
+public:
+    static MediaStream* srcObject(HTMLMediaElement*, bool& isNull);
+    static void setSrcObject(HTMLMediaElement*, MediaStream*);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && ENABLE(VIDEO)
+
+#endif // HTMLMediaElementMediaStream_h

Added: trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl (0 => 159797)


--- trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl	2013-11-27 02:13:04 UTC (rev 159797)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS 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=VIDEO&MEDIA_STREAM,
+] partial interface HTMLMediaElement
+{
+    attribute MediaStream? srcObject;
+};

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (159796 => 159797)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-27 02:13:04 UTC (rev 159797)
@@ -180,6 +180,8 @@
 		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 */; };
+		0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0779BF0A18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp */; };
+		0779BF0E18453168000B6AE7 /* HTMLMediaElementMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 0779BF0B18453168000B6AE7 /* HTMLMediaElementMediaStream.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 */; };
@@ -6796,6 +6798,9 @@
 		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>"; };
+		0779BF0A18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaElementMediaStream.cpp; sourceTree = "<group>"; };
+		0779BF0B18453168000B6AE7 /* HTMLMediaElementMediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMediaElementMediaStream.h; sourceTree = "<group>"; };
+		0779BF0C18453168000B6AE7 /* HTMLMediaElementMediaStream.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMediaElementMediaStream.idl; 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>"; };
@@ -13579,6 +13584,9 @@
 		07221B4617CEC32700848E51 /* mediastream */ = {
 			isa = PBXGroup;
 			children = (
+				0779BF0A18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp */,
+				0779BF0B18453168000B6AE7 /* HTMLMediaElementMediaStream.h */,
+				0779BF0C18453168000B6AE7 /* HTMLMediaElementMediaStream.idl */,
 				0705853917FE0770005F2BCB /* MediaTrackConstraint.cpp */,
 				0705853717FE044F005F2BCB /* MediaTrackConstraintSet.cpp */,
 				0705852617FDE02B005F2BCB /* MediaTrackConstraintSet.h */,
@@ -22811,6 +22819,7 @@
 				51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */,
 				97B38E27151C4271004622E9 /* DOMWindowNotifications.h in Headers */,
 				97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */,
+				0779BF0E18453168000B6AE7 /* HTMLMediaElementMediaStream.h in Headers */,
 				89F60B11157F686E0075E157 /* DOMWindowQuota.h in Headers */,
 				AA2A5AD616A4861600975A25 /* DOMWindowSpeechSynthesis.h in Headers */,
 				A8CCBB49151F831600AB7CE9 /* DOMWindowWebDatabase.h in Headers */,
@@ -26215,6 +26224,7 @@
 				2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */,
 				C57FEDE11212EE9C0097BE65 /* FileSystem.cpp in Sources */,
 				5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */,
+				0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
 				26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */,
 				CD3A495417A9CC9000274E42 /* MediaSourceBase.cpp in Sources */,
 				514B3F760C722055000530DF /* FileSystemMac.mm in Sources */,

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (159796 => 159797)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-11-27 02:13:04 UTC (rev 159797)
@@ -112,6 +112,7 @@
 #endif
 
 #if ENABLE(MEDIA_STREAM)
+#include "MediaStream.h"
 #include "MediaStreamRegistry.h"
 #endif
 
@@ -320,6 +321,9 @@
     , m_audioSessionManagerToken(AudioSessionManagerToken::create(tagName == videoTag ? AudioSessionManager::Video : AudioSessionManager::Audio))
 #endif
     , m_reportedExtraMemoryCost(0)
+#if ENABLE(MEDIA_STREAM)
+    , m_mediaStreamSrcObject(nullptr)
+#endif
 {
     LOG(Media, "HTMLMediaElement::HTMLMediaElement");
     setHasCustomStyleResolveCallbacks();
@@ -746,6 +750,20 @@
     setAttribute(srcAttr, url);
 }
 
+#if ENABLE(MEDIA_STREAM)
+void HTMLMediaElement::setSrcObject(MediaStream* mediaStream)
+{
+    // FIXME: Setting the srcObject attribute may cause other changes to the media element's internal state:
+    // Specifically, if srcObject is specified, the UA must use it as the source of media, even if the src
+    // attribute is also set or children are present. If the value of srcObject is replaced or set to null
+    // the UA must re-run the media element load algorithm.
+    //
+    // https://bugs.webkit.org/show_bug.cgi?id=124896
+
+    m_mediaStreamSrcObject = mediaStream;
+}
+#endif
+
 HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const
 {
     return m_networkState;

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (159796 => 159797)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2013-11-27 02:13:04 UTC (rev 159797)
@@ -48,8 +48,10 @@
 #include "VideoTrack.h"
 #endif
 
+#if ENABLE(MEDIA_STREAM)
+#include "MediaStream.h"
+#endif
 
-
 namespace WebCore {
 
 #if USE(AUDIO_SESSION)
@@ -139,10 +141,15 @@
 // error state
     PassRefPtr<MediaError> error() const;
 
-// network state
     void setSrc(const String&);
     const URL& currentSrc() const { return m_currentSrc; }
 
+#if ENABLE(MEDIA_STREAM)
+    MediaStream* srcObject() const { return m_mediaStreamSrcObject.get(); }
+    void setSrcObject(MediaStream*);
+#endif
+
+// network state
     enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO_SOURCE };
     NetworkState networkState() const;
 
@@ -797,6 +804,10 @@
     RefPtr<MediaControlsHost> m_mediaControlsHost;
     RefPtr<DOMWrapperWorld> m_isolatedWorld;
 #endif
+
+#if ENABLE(MEDIA_STREAM)
+    RefPtr<MediaStream> m_mediaStreamSrcObject;
+#endif
 };
 
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebKit2/CMakeLists.txt (159796 => 159797)


--- trunk/Source/WebKit2/CMakeLists.txt	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebKit2/CMakeLists.txt	2013-11-27 02:13:04 UTC (rev 159797)
@@ -64,6 +64,7 @@
     "${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics"
     "${WEBCORE_DIR}"
     "${WEBCORE_DIR}/Modules/battery"
+    "${WEBCORE_DIR}/Modules/mediastream"
     "${WEBCORE_DIR}/Modules/networkinfo"
     "${WEBCORE_DIR}/Modules/notifications"
     "${WEBCORE_DIR}/Modules/vibration"
@@ -100,6 +101,7 @@
     "${WEBCORE_DIR}/platform/graphics/surfaces"
     "${WEBCORE_DIR}/platform/graphics/texmap"
     "${WEBCORE_DIR}/platform/graphics/transforms"
+    "${WEBCORE_DIR}/platform/mediastream"
     "${WEBCORE_DIR}/platform/network"
     "${WEBCORE_DIR}/platform/sql"
     "${WEBCORE_DIR}/platform/text"

Modified: trunk/Source/WebKit2/ChangeLog (159796 => 159797)


--- trunk/Source/WebKit2/ChangeLog	2013-11-27 01:27:28 UTC (rev 159796)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-27 02:13:04 UTC (rev 159797)
@@ -1,3 +1,14 @@
+2013-11-26  Nick Diego Yamane  <nick.yam...@openbossa.org>
+
+        [MediaStream API] HTMLMediaElement should be able to use MediaStream as source
+        https://bugs.webkit.org/show_bug.cgi?id=121943
+
+        Reviewed by Eric Carlson.
+
+        Add mediastream module and platform to cmake include directories.
+
+        * CMakeLists.txt:
+
 2013-11-26  Dan Bernstein  <m...@apple.com>
 
         Some WebKit2 headers are not self-contained
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to