Title: [158606] trunk/Source/WebCore
Revision
158606
Author
[email protected]
Date
2013-11-04 15:52:32 -0800 (Mon, 04 Nov 2013)

Log Message

[MSE] Add a SourceBufferPrivateClient interface for platform -> html communication.
https://bugs.webkit.org/show_bug.cgi?id=123373

Reviewed by Eric Carlson.

To enable communication between SourceBuffer and SourceBufferPrivate without introducing
layering violations, add a new interface class SourceBufferPrivateInterface from which
SourceBuffer will inherit.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::SourceBuffer): Set the private's client.
(WebCore::SourceBuffer::~SourceBuffer): Clear the private's client.
(WebCore::SourceBuffer::sourceBufferPrivateDidEndStream): Added stub.
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): Hinno.
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
(WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
(WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
* Modules/mediasource/SourceBuffer.h:
* WebCore.xcodeproj/project.pbxproj: Add new files to project.
* platform/graphics/SourceBufferPrivate.h:
* platform/graphics/SourceBufferPrivateClient.h: Added.
(WebCore::SourceBufferPrivateClient::~SourceBufferPrivateClient): Empty destructor.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158605 => 158606)


--- trunk/Source/WebCore/ChangeLog	2013-11-04 23:47:46 UTC (rev 158605)
+++ trunk/Source/WebCore/ChangeLog	2013-11-04 23:52:32 UTC (rev 158606)
@@ -1,3 +1,28 @@
+2013-10-25  Jer Noble  <[email protected]>
+
+        [MSE] Add a SourceBufferPrivateClient interface for platform -> html communication.
+        https://bugs.webkit.org/show_bug.cgi?id=123373
+
+        Reviewed by Eric Carlson.
+
+        To enable communication between SourceBuffer and SourceBufferPrivate without introducing
+        layering violations, add a new interface class SourceBufferPrivateInterface from which
+        SourceBuffer will inherit.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::SourceBuffer): Set the private's client.
+        (WebCore::SourceBuffer::~SourceBuffer): Clear the private's client.
+        (WebCore::SourceBuffer::sourceBufferPrivateDidEndStream): Added stub.
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): Hinno.
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Ditto.
+        (WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
+        (WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
+        * Modules/mediasource/SourceBuffer.h:
+        * WebCore.xcodeproj/project.pbxproj: Add new files to project.
+        * platform/graphics/SourceBufferPrivate.h:
+        * platform/graphics/SourceBufferPrivateClient.h: Added.
+        (WebCore::SourceBufferPrivateClient::~SourceBufferPrivateClient): Empty destructor.
+
 2013-11-01  Jer Noble  <[email protected]>
 
         [PluginProxy] Add a setting to disable video plugin proxy support in HTMLMediaElement.

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (158605 => 158606)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2013-11-04 23:47:46 UTC (rev 158605)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2013-11-04 23:52:32 UTC (rev 158606)
@@ -35,6 +35,7 @@
 
 #include "Event.h"
 #include "GenericEventQueue.h"
+#include "HTMLMediaElement.h"
 #include "Logging.h"
 #include "MediaSource.h"
 #include "SourceBufferPrivate.h"
@@ -60,11 +61,15 @@
 {
     ASSERT(m_private);
     ASSERT(m_source);
+
+    m_private->setClient(this);
 }
 
 SourceBuffer::~SourceBuffer()
 {
     ASSERT(isRemoved());
+
+    m_private->setClient(0);
 }
 
 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionCode& ec) const
@@ -282,6 +287,29 @@
     scheduleEvent(eventNames().updateendEvent);
 }
 
+void SourceBuffer::sourceBufferPrivateDidEndStream(SourceBufferPrivate*, const WTF::AtomicString& error)
+{
+    m_source->endOfStream(error, IgnorableExceptionCode());
+}
+
+void SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment(SourceBufferPrivate*, const InitializationSegment&)
+{
+}
+
+void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample>)
+{
+}
+
+bool SourceBuffer::sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const
+{
+    return false;
+}
+
+bool SourceBuffer::sourceBufferPrivateHasVideo(const SourceBufferPrivate*) const
+{
+    return false;
+}
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (158605 => 158606)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h	2013-11-04 23:47:46 UTC (rev 158605)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h	2013-11-04 23:52:32 UTC (rev 158606)
@@ -38,6 +38,7 @@
 #include "ExceptionCode.h"
 #include "GenericEventQueue.h"
 #include "ScriptWrappable.h"
+#include "SourceBufferPrivateClient.h"
 #include "Timer.h"
 #include <runtime/ArrayBufferView.h>
 #include <wtf/PassRefPtr.h>
@@ -49,7 +50,7 @@
 class SourceBufferPrivate;
 class TimeRanges;
 
-class SourceBuffer FINAL : public RefCounted<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineData, public ScriptWrappable {
+class SourceBuffer FINAL : public RefCounted<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineData, public ScriptWrappable, public SourceBufferPrivateClient {
 public:
     static PassRef<SourceBuffer> create(PassRef<SourceBufferPrivate>, MediaSource*);
 
@@ -86,6 +87,13 @@
 private:
     SourceBuffer(PassRef<SourceBufferPrivate>, MediaSource*);
 
+    // SourceBufferPrivateClient
+    virtual void sourceBufferPrivateDidEndStream(SourceBufferPrivate*, const WTF::AtomicString&);
+    virtual void sourceBufferPrivateDidReceiveInitializationSegment(SourceBufferPrivate*, const InitializationSegment&) OVERRIDE;
+    virtual void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample>) OVERRIDE;
+    virtual bool sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const OVERRIDE;
+    virtual bool sourceBufferPrivateHasVideo(const SourceBufferPrivate*) const OVERRIDE;
+
     bool isRemoved() const;
     void scheduleEvent(const AtomicString& eventName);
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (158605 => 158606)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-04 23:47:46 UTC (rev 158605)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-04 23:52:32 UTC (rev 158606)
@@ -5361,10 +5361,12 @@
 		CDB859FA160D494900E5B07F /* JSMediaKeyEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB859F8160D493E00E5B07F /* JSMediaKeyEvent.cpp */; };
 		CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDC26B3C160A62B00026757B /* MockCDM.cpp */; };
 		CDC26B41160A8CCE0026757B /* MockCDM.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC26B3D160A62B00026757B /* MockCDM.h */; };
+		CDC61DA1180867D8004B913F /* SourceBufferPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC61DA0180867D8004B913F /* SourceBufferPrivate.h */; };
 		CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CDC69DD71632026C007C38DF /* WebCoreFullScreenWarningView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */; };
 		CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CDC69DDB16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */; };
+		CDC8B5AD1804AE5D0016E685 /* SourceBufferPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */; };
 		CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; };
 		CDE3A85417F5FCE600C5BE20 /* AudioTrackPrivateAVF.h in Headers */ = {isa = PBXBuildFile; fileRef = CDE3A85217F5FCE600C5BE20 /* AudioTrackPrivateAVF.h */; };
 		CDE3A85717F6020400C5BE20 /* AudioTrackPrivateAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDE3A85517F6020400C5BE20 /* AudioTrackPrivateAVFObjC.mm */; };
@@ -12301,6 +12303,7 @@
 		CD5393CC175DCCE600C07123 /* MemoryInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MemoryInfo.idl; sourceTree = "<group>"; };
 		CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMemoryInfo.cpp; sourceTree = "<group>"; };
 		CD5393D2175E018600C07123 /* JSMemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMemoryInfo.h; sourceTree = "<group>"; };
+		CD54A75E180F535000B076C9 /* MediaSourcePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourcePrivate.h; sourceTree = "<group>"; };
 		CD54DE4517468B6F005E5B36 /* AudioSessionManagerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSessionManagerMac.cpp; sourceTree = "<group>"; };
 		CD54DE4917469C6D005E5B36 /* AudioSessionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioSessionMac.cpp; sourceTree = "<group>"; };
 		CD641EBD1819B35900EE4C41 /* MediaTimeMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTimeMac.cpp; sourceTree = "<group>"; };
@@ -12374,10 +12377,12 @@
 		CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = mediaControlsApple.css; sourceTree = "<group>"; };
 		CDC26B3C160A62B00026757B /* MockCDM.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockCDM.cpp; sourceTree = "<group>"; };
 		CDC26B3D160A62B00026757B /* MockCDM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockCDM.h; sourceTree = "<group>"; };
+		CDC61DA0180867D8004B913F /* SourceBufferPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivate.h; sourceTree = "<group>"; };
 		CDC69DD41632026C007C38DF /* WebCoreFullScreenWarningView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWarningView.h; sourceTree = "<group>"; };
 		CDC69DD51632026C007C38DF /* WebCoreFullScreenWarningView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWarningView.mm; sourceTree = "<group>"; };
 		CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenPlaceholderView.h; sourceTree = "<group>"; };
 		CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenPlaceholderView.mm; sourceTree = "<group>"; };
+		CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivateClient.h; sourceTree = "<group>"; };
 		CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; };
 		CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentation.h; sourceTree = "<group>"; };
 		CDE3A85217F5FCE600C5BE20 /* AudioTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioTrackPrivateAVF.h; sourceTree = "<group>"; };
@@ -19120,6 +19125,9 @@
 				0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
 				B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
 				B2C3DA540D006CD600EF6F26 /* SimpleFontData.h */,
+				CDC61DA0180867D8004B913F /* SourceBufferPrivate.h */,
+				CD54A75E180F535000B076C9 /* MediaSourcePrivate.h */,
+				CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */,
 				B23540F00D00782E002382FA /* StringTruncator.cpp */,
 				B23540F10D00782E002382FA /* StringTruncator.h */,
 				087558C313B4A57D00F49307 /* SurrogatePairAwareTextIterator.cpp */,
@@ -22187,6 +22195,7 @@
 				07969DBA17D14151007FF842 /* JSRTCPeerConnection.h in Headers */,
 				84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */,
 				B2F34FE60E82F81400F627CD /* DNS.h in Headers */,
+				CDC61DA1180867D8004B913F /* SourceBufferPrivate.h in Headers */,
 				A8185F4009765766005826D9 /* Document.h in Headers */,
 				A3BB59F41457A40D00AC56FE /* DocumentEventQueue.h in Headers */,
 				A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */,
@@ -22669,6 +22678,7 @@
 				2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */,
 				2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */,
 				2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */,
+				CDC8B5AD1804AE5D0016E685 /* SourceBufferPrivateClient.h in Headers */,
 				514B3F730C722047000530DF /* FileSystem.h in Headers */,
 				26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */,
 				976D6C8E122B8A3D001FD1F7 /* FileThread.h in Headers */,

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (158605 => 158606)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2013-11-04 23:47:46 UTC (rev 158605)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2013-11-04 23:52:32 UTC (rev 158606)
@@ -37,10 +37,14 @@
 
 namespace WebCore {
 
+class SourceBufferPrivateClient;
+class TimeRanges;
+
 class SourceBufferPrivate : public RefCounted<SourceBufferPrivate> {
 public:
     virtual ~SourceBufferPrivate() { }
 
+    virtual void setClient(SourceBufferPrivateClient*) = 0;
     virtual PassRefPtr<TimeRanges> buffered() = 0;
     virtual void append(const unsigned char* data, unsigned length) = 0;
     virtual void abort() = 0;

Added: trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h (0 => 158606)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivateClient.h	2013-11-04 23:52:32 UTC (rev 158606)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SourceBufferPrivateClient_h
+#define SourceBufferPrivateClient_h
+
+#if ENABLE(MEDIA_SOURCE)
+
+#include <wtf/MediaTime.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class SourceBufferPrivate;
+class AudioTrackPrivate;
+class VideoTrackPrivate;
+class InbandTextTrackPrivate;
+class MediaSample;
+class MediaDescription;
+
+class SourceBufferPrivateClient {
+public:
+    virtual ~SourceBufferPrivateClient() { }
+
+    virtual void sourceBufferPrivateDidEndStream(SourceBufferPrivate*, const WTF::AtomicString&) = 0;
+
+    struct InitializationSegment {
+        MediaTime duration;
+
+        struct AudioTrackInformation {
+            RefPtr<MediaDescription> description;
+            RefPtr<AudioTrackPrivate> track;
+        };
+        Vector<AudioTrackInformation> audioTracks;
+
+        struct VideoTrackInformation {
+            RefPtr<MediaDescription> description;
+            RefPtr<VideoTrackPrivate> track;
+        };
+        Vector<VideoTrackInformation> videoTracks;
+
+        struct TextTrackInformation {
+            RefPtr<MediaDescription> description;
+            RefPtr<InbandTextTrackPrivate> track;
+        };
+        Vector<TextTrackInformation> textTracks;
+    };
+    virtual void sourceBufferPrivateDidReceiveInitializationSegment(SourceBufferPrivate*, const InitializationSegment&) = 0;
+    virtual void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample>) = 0;
+    virtual bool sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const = 0;
+    virtual bool sourceBufferPrivateHasVideo(const SourceBufferPrivate*) const = 0;
+};
+
+}
+
+#endif // ENABLE(MEDIA_SOURCE)
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to