[MediaStream API] HTMLMediaElement should be able to use MediaStream as source
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Nov 2013 02:13:04 +0000 (02:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Nov 2013 02:13:04 +0000 (02:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121943

Patch by Nick Diego Yamane <nick.yamane@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.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog

index 2b5b08d..123266f 100644 (file)
@@ -1,3 +1,16 @@
+2013-11-26  Nick Diego Yamane  <nick.yamane@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  <betravis@adobe.com>
 
         [CSS Shapes] Layout using [<box> || <shape>] value
diff --git a/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt b/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt
new file mode 100644 (file)
index 0000000..bf3003d
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html b/LayoutTests/fast/mediastream/MediaStream-MediaElement-srcObject.html
new file mode 100644 (file)
index 0000000..a5468fe
--- /dev/null
@@ -0,0 +1,54 @@
+<!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 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="../../resources/js-test-post.js"></script>
+    </body>
+</html>
index 94ebbb3..b6c70c6 100644 (file)
@@ -189,6 +189,7 @@ set(WebCore_IDL_FILES
     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 @@ set(WebCore_SOURCES
 
     Modules/mediastream/AudioStreamTrack.cpp
     Modules/mediastream/CapabilityRange.cpp
+    Modules/mediastream/HTMLMediaElementMediaStream.cpp
     Modules/mediastream/MediaConstraintsImpl.cpp
     Modules/mediastream/MediaSourceStates.cpp
     Modules/mediastream/MediaStream.cpp
index ad0529b..85a783e 100644 (file)
@@ -1,3 +1,30 @@
+2013-11-26  Nick Diego Yamane  <nick.yamane@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  <akling@apple.com>
 
         Use child iterator to find operators in RenderMathMLRow::layout().
index 6eb84a4..c280a65 100644 (file)
@@ -106,6 +106,7 @@ BINDING_IDLS = \
        $(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 \
index a109690..c0517c3 100644 (file)
@@ -355,6 +355,8 @@ webcore_built_sources += \
        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 @@ webcore_modules_sources += \
        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 \
diff --git a/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp b/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.cpp
new file mode 100644 (file)
index 0000000..1dc905a
--- /dev/null
@@ -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)
diff --git a/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h b/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.h
new file mode 100644 (file)
index 0000000..41bf484
--- /dev/null
@@ -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
diff --git a/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl b/Source/WebCore/Modules/mediastream/HTMLMediaElementMediaStream.idl
new file mode 100644 (file)
index 0000000..25eace3
--- /dev/null
@@ -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;
+};
index 594327a..82b1c30 100644 (file)
                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 */; };
                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>"; };
                07221B4617CEC32700848E51 /* mediastream */ = {
                        isa = PBXGroup;
                        children = (
+                               0779BF0A18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp */,
+                               0779BF0B18453168000B6AE7 /* HTMLMediaElementMediaStream.h */,
+                               0779BF0C18453168000B6AE7 /* HTMLMediaElementMediaStream.idl */,
                                0705853917FE0770005F2BCB /* MediaTrackConstraint.cpp */,
                                0705853717FE044F005F2BCB /* MediaTrackConstraintSet.cpp */,
                                0705852617FDE02B005F2BCB /* MediaTrackConstraintSet.h */,
                                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 */,
                                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 */,
index 44744d9..3407378 100644 (file)
 #endif
 
 #if ENABLE(MEDIA_STREAM)
+#include "MediaStream.h"
 #include "MediaStreamRegistry.h"
 #endif
 
@@ -320,6 +321,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
     , 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 @@ void HTMLMediaElement::setSrc(const String& url)
     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;
index 5642c97..f64d437 100644 (file)
@@ -48,7 +48,9 @@
 #include "VideoTrack.h"
 #endif
 
-
+#if ENABLE(MEDIA_STREAM)
+#include "MediaStream.h"
+#endif
 
 namespace WebCore {
 
@@ -139,10 +141,15 @@ public:
 // 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 @@ private:
     RefPtr<MediaControlsHost> m_mediaControlsHost;
     RefPtr<DOMWrapperWorld> m_isolatedWorld;
 #endif
+
+#if ENABLE(MEDIA_STREAM)
+    RefPtr<MediaStream> m_mediaStreamSrcObject;
+#endif
 };
 
 #if ENABLE(VIDEO_TRACK)
index 73b5e60..e20a9e5 100644 (file)
@@ -64,6 +64,7 @@ set(WebKit2_INCLUDE_DIRECTORIES
     "${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 @@ set(WebKit2_INCLUDE_DIRECTORIES
     "${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"
index 5df8a50..015aaf7 100644 (file)
@@ -1,3 +1,14 @@
+2013-11-26  Nick Diego Yamane  <nick.yamane@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  <mitz@apple.com>
 
         Some WebKit2 headers are not self-contained