Diff
Modified: trunk/Source/WebCore/ChangeLog (181892 => 181893)
--- trunk/Source/WebCore/ChangeLog 2015-03-24 15:11:39 UTC (rev 181892)
+++ trunk/Source/WebCore/ChangeLog 2015-03-24 15:18:21 UTC (rev 181893)
@@ -1,3 +1,44 @@
+2015-03-17 Philippe Normand <[email protected]>
+
+ [OpenWebRTC] RealtimeMediaSourceCenter implementation
+ https://bugs.webkit.org/show_bug.cgi?id=142476
+
+ Reviewed by Eric Carlson.
+
+ The old GStreamer MediaStreamCenter is replaced by the OpenWebRTC
+ RealtimeMediaSourceCenter. It is not yet able to correctly assess
+ MediaConstraints so it selects the first audio/video sources
+ available through OpenWebRTC.
+
+ * PlatformEfl.cmake: Add new files to the build.
+ * PlatformGTK.cmake: Ditto.
+ * platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp: Removed.
+ * platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp: Added.
+ (WebCore::initializeOpenWebRTC): Simple function to initialize the
+ framework, it is going to be used by the PeerConnection backend as well.
+ * platform/mediastream/openwebrtc/OpenWebRTCUtilities.h: Added.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: Added.
+ (WebCore::mediaSourcesAvailableCallback): Function invoked once
+ the media sources discovery succeeded within OpenWebRTC.
+ (WebCore::RealtimeMediaSourceCenter::platformCenter): Instantiate
+ the OpenWebRTC RealtimeMediaSourceCenter.
+ (WebCore::RealtimeMediaSourceCenterOwr::RealtimeMediaSourceCenterOwr):
+ (WebCore::RealtimeMediaSourceCenterOwr::~RealtimeMediaSourceCenterOwr):
+ (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
+ Schedule a discovery process for the capture sources.
+ (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Pick
+ the first audio/video sources and create a MediaStream accordingly.
+ (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources):
+ Not yet implemented.
+ (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
+ Method invoked once the capture sources process succeeded. Parse
+ them and create an internal cache of RealtimeMediaSources accordingly.
+ (WebCore::RealtimeMediaSourceCenterOwr::firstSource): Utility
+ function to fetch the first source of the given type from the
+ RealtimeMediaSources cache.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: Added.
+
2015-03-24 Csaba Osztrogonác <[email protected]>
[EFL] Add OpenWebRTC in jhbuild
Modified: trunk/Source/WebCore/PlatformEfl.cmake (181892 => 181893)
--- trunk/Source/WebCore/PlatformEfl.cmake 2015-03-24 15:11:39 UTC (rev 181892)
+++ trunk/Source/WebCore/PlatformEfl.cmake 2015-03-24 15:18:21 UTC (rev 181893)
@@ -18,7 +18,7 @@
"${WEBCORE_DIR}/platform/graphics/texmap"
"${WEBCORE_DIR}/platform/graphics/texmap/coordinated"
"${WEBCORE_DIR}/platform/linux"
- "${WEBCORE_DIR}/platform/mediastream/gstreamer"
+ "${WEBCORE_DIR}/platform/mediastream/openwebrtc"
"${WEBCORE_DIR}/platform/mock/mediasource"
"${WEBCORE_DIR}/platform/network/soup"
"${WEBCORE_DIR}/platform/text/efl"
@@ -213,7 +213,8 @@
platform/linux/GamepadDeviceLinux.cpp
platform/linux/MemoryPressureHandlerLinux.cpp
- platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
+ platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp
+ platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
platform/network/efl/NetworkStateNotifierEfl.cpp
Modified: trunk/Source/WebCore/PlatformGTK.cmake (181892 => 181893)
--- trunk/Source/WebCore/PlatformGTK.cmake 2015-03-24 15:11:39 UTC (rev 181892)
+++ trunk/Source/WebCore/PlatformGTK.cmake 2015-03-24 15:18:21 UTC (rev 181893)
@@ -16,7 +16,7 @@
"${WEBCORE_DIR}/platform/graphics/opentype"
"${WEBCORE_DIR}/platform/graphics/wayland"
"${WEBCORE_DIR}/platform/linux"
- "${WEBCORE_DIR}/platform/mediastream/gstreamer"
+ "${WEBCORE_DIR}/platform/mediastream/openwebrtc"
"${WEBCORE_DIR}/platform/mock/mediasource"
"${WEBCORE_DIR}/platform/network/gtk"
"${WEBCORE_DIR}/platform/network/soup"
@@ -153,7 +153,8 @@
platform/linux/GamepadDeviceLinux.cpp
platform/linux/MemoryPressureHandlerLinux.cpp
- platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
+ platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp
+ platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
platform/network/soup/AuthenticationChallengeSoup.cpp
platform/network/soup/CertificateInfo.cpp
Deleted: trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp (181892 => 181893)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp 2015-03-24 15:11:39 UTC (rev 181892)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp 2015-03-24 15:18:21 UTC (rev 181893)
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2011 Ericsson AB. All rights reserved.
- * Copyright (C) 2012 Google 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.
- * 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 "MediaStreamCenterGStreamer.h"
-
-#include "MediaStreamCreationClient.h"
-#include "MediaStreamPrivate.h"
-#include "MediaStreamTrackSourcesRequestClient.h"
-#include "NotImplemented.h"
-#include "RealtimeMediaSourceCapabilities.h"
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::platformCenter()
-{
- ASSERT(isMainThread());
- DEPRECATED_DEFINE_STATIC_LOCAL(MediaStreamCenterGStreamer, center, ());
- return center;
-}
-
-MediaStreamCenterGStreamer::MediaStreamCenterGStreamer()
-{
-}
-
-MediaStreamCenterGStreamer::~MediaStreamCenterGStreamer()
-{
-}
-
-void MediaStreamCenterGStreamer::validateRequestConstraints(PassRefPtr<MediaStreamCreationClient> prpQueryClient, PassRefPtr<MediaConstraints>, PassRefPtr<MediaConstraints>)
-{
- RefPtr<MediaStreamCreationClient> client = prpQueryClient;
- // FIXME: Actually do constraints validation. The MediaConstraints
- // need to comply with the available audio/video device(s)
- // capabilities. See bug #123345.
- client->constraintsValidated();
-}
-
-void MediaStreamCenterGStreamer::createMediaStream(PassRefPtr<MediaStreamCreationClient> prpQueryClient, PassRefPtr<MediaConstraints>, PassRefPtr<MediaConstraints>)
-{
- RefPtr<MediaStreamCreationClient> client = prpQueryClient;
- ASSERT(client);
-
- Vector<RefPtr<RealtimeMediaSource>> audioSources;
- Vector<RefPtr<RealtimeMediaSource>> videoSources;
- // FIXME: fill source vectors, see bug #110150.
- client->didCreateStream(MediaStreamPrivate::create(audioSources, videoSources));
-
-}
-
-bool MediaStreamCenterGStreamer::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>)
-{
- notImplemented();
- return false;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
Deleted: trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h (181892 => 181893)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h 2015-03-24 15:11:39 UTC (rev 181892)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h 2015-03-24 15:18:21 UTC (rev 181893)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 Ericsson AB. All rights reserved.
- * Copyright (C) 2012 Google 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.
- * 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 MediaStreamCenterGStreamer_h
-#define MediaStreamCenterGStreamer_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "RealtimeMediaSourceCenter.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class MediaStreamPrivate;
-class RealtimeMediaSource;
-class MediaStreamSourcesQueryClient;
-
-class MediaStreamCenterGStreamer : public RealtimeMediaSourceCenter {
-public:
- MediaStreamCenterGStreamer();
- ~MediaStreamCenterGStreamer();
-
- virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
- virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
- virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) override;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // MediaStreamCenterGStreamer_h
Added: trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp (0 => 181893)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp 2015-03-24 15:18:21 UTC (rev 181893)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 Igalia S.L
+ * Copyright (C) 2015 Metrological
+ *
+ * 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 the copyright holder 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
+ * HOLDER 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 USE(OPENWEBRTC)
+#include "OpenWebRTCUtilities.h"
+
+#include <owr/owr.h>
+
+namespace WebCore {
+
+void initializeOpenWebRTC()
+{
+ owr_init_with_main_context(g_main_context_default());
+}
+
+}
+
+#endif // USE(OPENWEBRTC)
Added: trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.h (0 => 181893)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/OpenWebRTCUtilities.h 2015-03-24 15:18:21 UTC (rev 181893)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 Igalia S.L
+ * Copyright (C) 2015 Metrological
+ *
+ * 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 the copyright holder 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
+ * HOLDER 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.
+ */
+
+
+namespace WebCore {
+
+void initializeOpenWebRTC();
+
+}
Added: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp (0 => 181893)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 2015-03-24 15:18:21 UTC (rev 181893)
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ * Copyright (C) 2015 Metrological. 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) && USE(OPENWEBRTC)
+#include "RealtimeMediaSourceCenterOwr.h"
+
+#include "MediaStreamCreationClient.h"
+#include "MediaStreamPrivate.h"
+#include "MediaStreamTrackSourcesRequestClient.h"
+#include "NotImplemented.h"
+#include "OpenWebRTCUtilities.h"
+#include "RealtimeMediaSource.h"
+#include "RealtimeMediaSourceCapabilities.h"
+#include "UUID.h"
+#include <owr/owr.h>
+#include <owr/owr_local.h>
+#include <owr/owr_media_source.h>
+#include <wtf/MainThread.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/gobject/GUniquePtr.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringHash.h>
+
+
+namespace WebCore {
+
+RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::platformCenter()
+{
+ ASSERT(isMainThread());
+ static NeverDestroyed<RealtimeMediaSourceCenterOwr> center;
+ return center;
+}
+
+static void mediaSourcesAvailableCallback(GList* sources, gpointer userData)
+{
+ RealtimeMediaSourceCenterOwr* center = reinterpret_cast<RealtimeMediaSourceCenterOwr*>(userData);
+ center->mediaSourcesAvailable(sources);
+}
+
+RealtimeMediaSourceCenterOwr::RealtimeMediaSourceCenterOwr()
+{
+ initializeOpenWebRTC();
+}
+
+RealtimeMediaSourceCenterOwr::~RealtimeMediaSourceCenterOwr()
+{
+}
+
+void RealtimeMediaSourceCenterOwr::validateRequestConstraints(PassRefPtr<MediaStreamCreationClient> prpClient, PassRefPtr<MediaConstraints> prpAudioConstraints, PassRefPtr<MediaConstraints> prpVideoConstraints)
+{
+ m_client = prpClient;
+ ASSERT(m_client);
+
+ // FIXME: Actually do constraints validation. The MediaConstraints
+ // need to comply with the available audio/video device(s)
+ // capabilities. See bug #123345.
+ RefPtr<MediaConstraints> audioConstraints = prpAudioConstraints;
+ RefPtr<MediaConstraints> videoConstraints = prpVideoConstraints;
+
+ int types;
+ if (audioConstraints)
+ types |= OWR_MEDIA_TYPE_AUDIO;
+ if (videoConstraints)
+ types |= OWR_MEDIA_TYPE_VIDEO;
+
+ owr_get_capture_sources(static_cast<OwrMediaType>(types), mediaSourcesAvailableCallback, this);
+}
+
+void RealtimeMediaSourceCenterOwr::createMediaStream(PassRefPtr<MediaStreamCreationClient> prpQueryClient, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints)
+{
+ RefPtr<MediaStreamCreationClient> client = prpQueryClient;
+ ASSERT(client);
+
+ UNUSED_PARAM(audioConstraints);
+ UNUSED_PARAM(videoConstraints);
+
+ Vector<RefPtr<RealtimeMediaSource>> audioSources;
+ Vector<RefPtr<RealtimeMediaSource>> videoSources;
+
+ if (audioConstraints) {
+ // TODO: verify constraints according to registered
+ // sources. For now, unconditionally pick the first source, see bug #123345.
+ RefPtr<RealtimeMediaSource> audioSource = firstSource(RealtimeMediaSource::Audio);
+ if (audioSource) {
+ audioSource->reset();
+ audioSource->setReadyState(RealtimeMediaSource::Live);
+ audioSources.append(audioSource.release());
+ }
+ }
+
+ if (videoConstraints) {
+ // TODO: verify constraints according to registered
+ // sources. For now, unconditionally pick the first source, see bug #123345.
+ RefPtr<RealtimeMediaSource> videoSource = firstSource(RealtimeMediaSource::Video);
+ if (videoSource) {
+ videoSource->reset();
+ videoSource->setReadyState(RealtimeMediaSource::Live);
+ videoSources.append(videoSource.release());
+ }
+ }
+
+ client->didCreateStream(MediaStreamPrivate::create(audioSources, videoSources));
+}
+
+bool RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>)
+{
+ notImplemented();
+ return false;
+}
+
+void RealtimeMediaSourceCenterOwr::mediaSourcesAvailable(GList* sources)
+{
+ for (auto item = sources; item; item = item->next) {
+ OwrMediaSource* source = OWR_MEDIA_SOURCE(item->data);
+
+ GUniqueOutPtr<gchar> name;
+ OwrMediaType mediaType;
+ g_object_get(source, "media-type", &mediaType, "name", &name.outPtr(), NULL);
+ String sourceName(name.get());
+ String id(createCanonicalUUIDString());
+
+ RealtimeMediaSource::Type sourceType;
+ if (mediaType & OWR_MEDIA_TYPE_AUDIO)
+ sourceType = RealtimeMediaSource::Audio;
+ else if (mediaType & OWR_MEDIA_TYPE_VIDEO)
+ sourceType = RealtimeMediaSource::Video;
+ else
+ ASSERT_NOT_REACHED();
+
+ RefPtr<RealtimeMediaSourceOwr> mediaSource = adoptRef(new RealtimeMediaSourceOwr(source, id, sourceType, sourceName));
+
+ RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(id);
+ if (sourceIterator == m_sourceMap.end())
+ m_sourceMap.add(id, mediaSource);
+
+ }
+
+ // TODO: Make sure contraints are actually validated by checking source types.
+ m_client->constraintsValidated();
+}
+
+PassRefPtr<RealtimeMediaSource> RealtimeMediaSourceCenterOwr::firstSource(RealtimeMediaSource::Type type)
+{
+ for (auto iter = m_sourceMap.begin(); iter != m_sourceMap.end(); ++iter) {
+ RefPtr<RealtimeMediaSource> source = iter->value;
+ if (source->type() == type)
+ return source;
+ }
+
+ return nullptr;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
Copied: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h (from rev 181892, trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h) (0 => 181893)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h 2015-03-24 15:18:21 UTC (rev 181893)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 Ericsson AB. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Igalia S.L. All rights reserved.
+ * Copyright (C) 2015 Metrological. 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 RealtimeMediaSourceCenterOwr_h
+#define RealtimeMediaSourceCenterOwr_h
+
+#if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#include "RealtimeMediaSourceCenter.h"
+
+#include "RealtimeMediaSourceOwr.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class MediaStreamPrivate;
+class RealtimeMediaSource;
+class MediaStreamSourcesQueryClient;
+
+class RealtimeMediaSourceCenterOwr final : public RealtimeMediaSourceCenter {
+public:
+ RealtimeMediaSourceCenterOwr();
+ ~RealtimeMediaSourceCenterOwr();
+
+ virtual void validateRequestConstraints(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
+ virtual void createMediaStream(PassRefPtr<MediaStreamCreationClient>, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints);
+ virtual bool getMediaStreamTrackSources(PassRefPtr<MediaStreamTrackSourcesRequestClient>) override;
+
+ void mediaSourcesAvailable(GList* sources);
+
+private:
+ PassRefPtr<RealtimeMediaSource> firstSource(RealtimeMediaSource::Type);
+ RealtimeMediaSourceOwrMap m_sourceMap;
+ RefPtr<MediaStreamCreationClient> m_client;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#endif // RealtimeMediaSourceCenterOwr_h
Added: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h (0 => 181893)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h 2015-03-24 15:18:21 UTC (rev 181893)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 Igalia S.L
+ * Copyright (C) 2015 Metrological
+ *
+ * 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 the copyright holder 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
+ * HOLDER 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 RealtimeMediaSourceOwr_h
+#define RealtimeMediaSourceOwr_h
+
+#if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#include "GRefPtrGStreamer.h"
+#include "RealtimeMediaSource.h"
+#include <owr/owr_media_source.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RealtimeMediaSourceCapabilities;
+
+class RealtimeMediaSourceOwr final : public RealtimeMediaSource {
+public:
+RealtimeMediaSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name)
+ : RealtimeMediaSource(id, type, name)
+ , m_mediaSource(mediaSource)
+ {
+ }
+
+ virtual ~RealtimeMediaSourceOwr() { }
+
+ virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const { return m_capabilities; }
+ virtual const RealtimeMediaSourceStates& states() { return m_currentStates; }
+
+ OwrMediaSource* mediaSource() const { return m_mediaSource; }
+
+private:
+ RefPtr<RealtimeMediaSourceCapabilities> m_capabilities;
+ RealtimeMediaSourceStates m_currentStates;
+ OwrMediaSource* m_mediaSource;
+};
+
+typedef HashMap<String, RefPtr<RealtimeMediaSourceOwr>> RealtimeMediaSourceOwrMap;
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#endif // RealtimeMediaSourceOwr_h