Title: [96959] trunk/Source/WebCore
Revision
96959
Author
[email protected]
Date
2011-10-07 11:06:40 -0700 (Fri, 07 Oct 2011)

Log Message

Add WebCore platform interfaces needed by updated PeerConnection design
https://bugs.webkit.org/show_bug.cgi?id=68460

Patch by Adam Bergkvist <[email protected]> on 2011-10-07
Reviewed by Adam Barth.

Added the PeerConnection platform files to WebCore/platform/mediastream

Currently not testable.

* GNUmakefile.am:
* GNUmakefile.list.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* platform/mediastream/MediaStreamComponent.h: Added.
(WebCore::MediaStreamComponent::create):
(WebCore::MediaStreamComponent::source):
(WebCore::MediaStreamComponent::enabled):
(WebCore::MediaStreamComponent::setEnabled):
(WebCore::MediaStreamComponent::MediaStreamComponent):
* platform/mediastream/MediaStreamDescriptor.h: Added.
(WebCore::MediaStreamDescriptor::create):
(WebCore::MediaStreamDescriptor::owner):
(WebCore::MediaStreamDescriptor::setOwner):
(WebCore::MediaStreamDescriptor::label):
(WebCore::MediaStreamDescriptor::component):
(WebCore::MediaStreamDescriptor::numberOfComponents):
(WebCore::MediaStreamDescriptor::ended):
(WebCore::MediaStreamDescriptor::setEnded):
(WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
* platform/mediastream/MediaStreamSource.h: Added.
(WebCore::MediaStreamSource::create):
(WebCore::MediaStreamSource::id):
(WebCore::MediaStreamSource::type):
(WebCore::MediaStreamSource::name):
(WebCore::MediaStreamSource::muted):
(WebCore::MediaStreamSource::setMuted):
(WebCore::MediaStreamSource::MediaStreamSource):
* platform/mediastream/PeerHandler.cpp: Added.
(WebCore::PeerHandler::PeerHandler):
(WebCore::PeerHandler::~PeerHandler):
(WebCore::PeerHandler::produceInitialOffer):
(WebCore::PeerHandler::handleInitialOffer):
(WebCore::PeerHandler::processSDP):
(WebCore::PeerHandler::processPendingStreams):
(WebCore::PeerHandler::sendDataStreamMessage):
(WebCore::PeerHandler::stop):
* platform/mediastream/PeerHandler.h: Added.
(WebCore::PeerHandlerClient::~PeerHandlerClient):
(WebCore::PeerHandler::create):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96958 => 96959)


--- trunk/Source/WebCore/ChangeLog	2011-10-07 17:44:07 UTC (rev 96958)
+++ trunk/Source/WebCore/ChangeLog	2011-10-07 18:06:40 UTC (rev 96959)
@@ -1,3 +1,55 @@
+2011-10-07  Adam Bergkvist  <[email protected]>
+
+        Add WebCore platform interfaces needed by updated PeerConnection design
+        https://bugs.webkit.org/show_bug.cgi?id=68460
+
+        Reviewed by Adam Barth.
+
+        Added the PeerConnection platform files to WebCore/platform/mediastream
+
+        Currently not testable.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * platform/mediastream/MediaStreamComponent.h: Added.
+        (WebCore::MediaStreamComponent::create):
+        (WebCore::MediaStreamComponent::source):
+        (WebCore::MediaStreamComponent::enabled):
+        (WebCore::MediaStreamComponent::setEnabled):
+        (WebCore::MediaStreamComponent::MediaStreamComponent):
+        * platform/mediastream/MediaStreamDescriptor.h: Added.
+        (WebCore::MediaStreamDescriptor::create):
+        (WebCore::MediaStreamDescriptor::owner):
+        (WebCore::MediaStreamDescriptor::setOwner):
+        (WebCore::MediaStreamDescriptor::label):
+        (WebCore::MediaStreamDescriptor::component):
+        (WebCore::MediaStreamDescriptor::numberOfComponents):
+        (WebCore::MediaStreamDescriptor::ended):
+        (WebCore::MediaStreamDescriptor::setEnded):
+        (WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
+        * platform/mediastream/MediaStreamSource.h: Added.
+        (WebCore::MediaStreamSource::create):
+        (WebCore::MediaStreamSource::id):
+        (WebCore::MediaStreamSource::type):
+        (WebCore::MediaStreamSource::name):
+        (WebCore::MediaStreamSource::muted):
+        (WebCore::MediaStreamSource::setMuted):
+        (WebCore::MediaStreamSource::MediaStreamSource):
+        * platform/mediastream/PeerHandler.cpp: Added.
+        (WebCore::PeerHandler::PeerHandler):
+        (WebCore::PeerHandler::~PeerHandler):
+        (WebCore::PeerHandler::produceInitialOffer):
+        (WebCore::PeerHandler::handleInitialOffer):
+        (WebCore::PeerHandler::processSDP):
+        (WebCore::PeerHandler::processPendingStreams):
+        (WebCore::PeerHandler::sendDataStreamMessage):
+        (WebCore::PeerHandler::stop):
+        * platform/mediastream/PeerHandler.h: Added.
+        (WebCore::PeerHandlerClient::~PeerHandlerClient):
+        (WebCore::PeerHandler::create):
+
 2011-10-07  Vineet Chaudary  <[email protected]>
 
         background-color affects the font color in disabled textarea.

Modified: trunk/Source/WebCore/GNUmakefile.am (96958 => 96959)


--- trunk/Source/WebCore/GNUmakefile.am	2011-10-07 17:44:07 UTC (rev 96958)
+++ trunk/Source/WebCore/GNUmakefile.am	2011-10-07 18:06:40 UTC (rev 96959)
@@ -60,6 +60,7 @@
 	-I$(srcdir)/Source/WebCore/platform/image-decoders/webp \
 	-I$(srcdir)/Source/WebCore/platform/image-decoders/png \
 	-I$(srcdir)/Source/WebCore/platform/leveldb \
+	-I$(srcdir)/Source/WebCore/platform/mediastream \
 	-I$(srcdir)/Source/WebCore/platform/mock \
 	-I$(srcdir)/Source/WebCore/platform/network \
 	-I$(srcdir)/Source/WebCore/platform/sql \

Modified: trunk/Source/WebCore/GNUmakefile.list.am (96958 => 96959)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-10-07 17:44:07 UTC (rev 96958)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-10-07 18:06:40 UTC (rev 96959)
@@ -2695,6 +2695,11 @@
 	Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h \
 	Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp \
 	Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h \
+	Source/WebCore/platform/mediastream/MediaStreamComponent.h \
+	Source/WebCore/platform/mediastream/MediaStreamDescriptor.h \
+	Source/WebCore/platform/mediastream/MediaStreamSource.h \
+	Source/WebCore/platform/mediastream/PeerHandler.cpp \
+	Source/WebCore/platform/mediastream/PeerHandler.h \
 	Source/WebCore/platform/mock/DeviceOrientationClientMock.cpp \
 	Source/WebCore/platform/mock/DeviceOrientationClientMock.h \
 	Source/WebCore/platform/mock/GeolocationClientMock.cpp \

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (96958 => 96959)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2011-10-07 17:44:07 UTC (rev 96958)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2011-10-07 18:06:40 UTC (rev 96959)
@@ -193,6 +193,7 @@
       '../platform/image-decoders/webp',
       '../platform/image-encoders/skia',
       '../platform/leveldb',
+      '../platform/mediastream',
       '../platform/mock',
       '../platform/network',
       '../platform/network/chromium',

Modified: trunk/Source/WebCore/WebCore.gypi (96958 => 96959)


--- trunk/Source/WebCore/WebCore.gypi	2011-10-07 17:44:07 UTC (rev 96958)
+++ trunk/Source/WebCore/WebCore.gypi	2011-10-07 18:06:40 UTC (rev 96959)
@@ -810,6 +810,11 @@
             'platform/mac/WebCoreSystemInterface.h',
             'platform/mac/WebCoreView.h',
             'platform/mac/WebFontCache.h',
+            'platform/mediastream/MediaStreamComponent.h',
+            'platform/mediastream/MediaStreamDescriptor.h',
+            'platform/mediastream/MediaStreamSource.h',
+            'platform/mediastream/PeerHandler.cpp',
+            'platform/mediastream/PeerHandler.h',
             'platform/mock/DeviceOrientationClientMock.h',
             'platform/mock/GeolocationClientMock.h',
             'platform/network/AuthenticationChallengeBase.h',

Added: trunk/Source/WebCore/platform/mediastream/MediaStreamComponent.h (0 => 96959)


--- trunk/Source/WebCore/platform/mediastream/MediaStreamComponent.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamComponent.h	2011-10-07 18:06:40 UTC (rev 96959)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. 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.
+ * 3. Neither the name of Ericsson nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 MediaStreamComponent_h
+#define MediaStreamComponent_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamSource.h"
+
+namespace WebCore {
+
+class MediaStreamComponent : public RefCounted<MediaStreamComponent> {
+public:
+    static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource> source)
+    {
+        return adoptRef(new MediaStreamComponent(source));
+    }
+
+    MediaStreamSource* source() const { return m_source.get(); }
+
+    bool enabled() const { return m_enabled; }
+    void setEnabled(bool enabled) { m_enabled = enabled; }
+
+private:
+    MediaStreamComponent(PassRefPtr<MediaStreamSource> source)
+        : m_source(source)
+        , m_enabled(true)
+    {
+    }
+
+    RefPtr<MediaStreamSource> m_source;
+    bool m_enabled;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamComponent_h

Added: trunk/Source/WebCore/platform/mediastream/MediaStreamDescriptor.h (0 => 96959)


--- trunk/Source/WebCore/platform/mediastream/MediaStreamDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamDescriptor.h	2011-10-07 18:06:40 UTC (rev 96959)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. 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.
+ * 3. Neither the name of Ericsson nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 MediaStreamDescriptor_h
+#define MediaStreamDescriptor_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamComponent.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class MediaStream;
+
+class MediaStreamDescriptor : public RefCounted<MediaStreamDescriptor> {
+public:
+    static PassRefPtr<MediaStreamDescriptor> create(const String& label, const MediaStreamSourceVector& sources)
+    {
+        return adoptRef(new MediaStreamDescriptor(label, sources));
+    }
+
+    MediaStream* owner() const { return m_owner; }
+    void setOwner(MediaStream* owner) { m_owner = owner; }
+
+    String label() const { return m_label; }
+
+    MediaStreamComponent* component(unsigned index) const { return m_components[index].get(); }
+    unsigned numberOfComponents() const { return m_components.size(); }
+
+    bool ended() const { return m_ended; }
+    void setEnded() { m_ended = true; }
+
+private:
+    MediaStreamDescriptor(const String& label, const MediaStreamSourceVector& sources)
+        : m_owner(0)
+        , m_label(label)
+        , m_ended(false)
+    {
+        for (size_t i = 0; i < sources.size(); i++)
+            m_components.append(MediaStreamComponent::create(sources[i]));
+    }
+
+    MediaStream* m_owner;
+    String m_label;
+    Vector<RefPtr<MediaStreamComponent> > m_components;
+    bool m_ended;
+};
+
+typedef Vector<RefPtr<MediaStreamDescriptor> > MediaStreamDescriptorVector;
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamDescriptor_h

Added: trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h (0 => 96959)


--- trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h	2011-10-07 18:06:40 UTC (rev 96959)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. 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.
+ * 3. Neither the name of Ericsson nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 MediaStreamSource_h
+#define MediaStreamSource_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class MediaStreamSource : public RefCounted<MediaStreamSource> {
+public:
+    enum Type {
+        TypeAudio,
+        TypeVideo
+    };
+
+    static PassRefPtr<MediaStreamSource> create(const String& id, Type type, const String& name)
+    {
+        return adoptRef(new MediaStreamSource(id, type, name));
+    }
+
+    const String& id() const { return m_id; }
+    Type type() const { return m_type; }
+    const String& name() const { return m_name; }
+
+    bool muted() const { return m_muted; }
+    void setMuted(bool muted) { m_muted = muted; }
+
+private:
+    MediaStreamSource(const String& id, Type type, const String& name)
+        : m_id(id)
+        , m_type(type)
+        , m_name(name)
+        , m_muted(false)
+    {
+    }
+
+    String m_id;
+    Type m_type;
+    String m_name;
+    bool m_muted;
+};
+
+typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector;
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamSource_h

Added: trunk/Source/WebCore/platform/mediastream/PeerHandler.cpp (0 => 96959)


--- trunk/Source/WebCore/platform/mediastream/PeerHandler.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/PeerHandler.cpp	2011-10-07 18:06:40 UTC (rev 96959)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. 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.
+ * 3. Neither the name of Ericsson nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "PeerHandler.h"
+
+namespace WebCore {
+
+// FIXME: remove when real implementations are available
+// Empty implementations for ports that build with MEDIA_STREAM enabled by default.
+PeerHandler::PeerHandler(PeerHandlerClient*, const String&, const String&)
+{
+}
+
+PeerHandler::~PeerHandler()
+{
+}
+
+void PeerHandler::produceInitialOffer(const MediaStreamDescriptorVector&)
+{
+}
+
+void PeerHandler::handleInitialOffer(const String&)
+{
+}
+
+void PeerHandler::processSDP(const String&)
+{
+}
+
+void PeerHandler::processPendingStreams(const MediaStreamDescriptorVector&, const MediaStreamDescriptorVector&)
+{
+}
+
+void PeerHandler::sendDataStreamMessage(const char*, unsigned)
+{
+}
+
+void PeerHandler::stop()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)

Added: trunk/Source/WebCore/platform/mediastream/PeerHandler.h (0 => 96959)


--- trunk/Source/WebCore/platform/mediastream/PeerHandler.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/PeerHandler.h	2011-10-07 18:06:40 UTC (rev 96959)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. 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.
+ * 3. Neither the name of Ericsson nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER 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 PeerHandler_h
+#define PeerHandler_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "MediaStreamDescriptor.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class PeerHandlerClient {
+public:
+    virtual ~PeerHandlerClient() { }
+
+    virtual void iceProcessingCompleted() = 0;
+    virtual void sdpGenerated(const String& sdp) = 0;
+    virtual void dataStreamMessageReceived(const char* data, unsigned length) = 0;
+    virtual void remoteStreamAdded(PassRefPtr<MediaStreamDescriptor>) = 0;
+    virtual void remoteStreamRemoved(MediaStreamDescriptor*) = 0;
+};
+
+class PeerHandler {
+    WTF_MAKE_NONCOPYABLE(PeerHandler);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassOwnPtr<PeerHandler> create(PeerHandlerClient* client, const String& serverConfiguration, const String& username)
+    {
+        return adoptPtr(new PeerHandler(client, serverConfiguration, username));
+    }
+    virtual ~PeerHandler();
+
+    void produceInitialOffer(const MediaStreamDescriptorVector& pendingAddStreams);
+    void handleInitialOffer(const String& sdp);
+    void processSDP(const String& sdp);
+    void processPendingStreams(const MediaStreamDescriptorVector& pendingAddStreams, const MediaStreamDescriptorVector& pendingRemoveStreams);
+    void sendDataStreamMessage(const char* data, unsigned length);
+
+    void stop();
+
+private:
+    PeerHandler(PeerHandlerClient*, const String& serverConfiguration, const String& username);
+
+    PeerHandlerClient* m_client;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // PeerHandler_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to