https://bugs.webkit.org/show_bug.cgi?id=73130
Reviewed by Darin Fisher.
Source/WebCore:
Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.
* mediastream/UserMediaClient.h:
(UserMediaClient):
* mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::didCompleteQuery):
* mediastream/UserMediaRequest.h:
(UserMediaRequest):
(WebCore::UserMediaRequest::audio):
(WebCore::UserMediaRequest::video):
(WebCore::UserMediaRequest::cameraPreferenceUser):
(WebCore::UserMediaRequest::cameraPreferenceEnvironment):
* platform/mediastream/MediaStreamCenter.cpp:
(WebCore):
(WebCore::MediaStreamCenter::queryMediaStreamSources):
* platform/mediastream/MediaStreamCenter.h:
(WebCore):
(MediaStreamSourcesQueryClient):
(MediaStreamCenter):
Source/WebKit/chromium:
* WebKit.gyp:
* bridge/MediaStreamCenter.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebCore::MediaStreamCenter::MediaStreamCenter):
(WebCore::MediaStreamCenter::~MediaStreamCenter):
(WebCore::MediaStreamCenter::queryMediaStreamSources):
(WebCore::MediaStreamCenter::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenter::didStopLocalMediaStream):
(WebCore::MediaStreamCenter::didConstructMediaStream):
* bridge/MediaStreamCenterInternal.cpp: Added.
(WebCore):
(WebCore::MediaStreamCenterInternal::MediaStreamCenterInternal):
(WebCore::MediaStreamCenterInternal::~MediaStreamCenterInternal):
(WebCore::MediaStreamCenterInternal::queryMediaStreamSources):
(WebCore::MediaStreamCenterInternal::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenterInternal::didStopLocalMediaStream):
(WebCore::MediaStreamCenterInternal::didConstructMediaStream):
(WebCore::MediaStreamCenterInternal::stopLocalMediaStream):
* bridge/MediaStreamCenterInternal.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebCore):
(MediaStreamCenterInternal):
* public/platform/WebKitPlatformSupport.h:
(WebKit):
(WebKit::WebKitPlatformSupport::createMediaStreamCenter):
* public/platform/WebMediaStreamCenter.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebMediaStreamCenter):
(WebKit::WebMediaStreamCenter::~WebMediaStreamCenter):
* public/platform/WebMediaStreamCenterClient.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebMediaStreamCenterClient):
(WebKit::WebMediaStreamCenterClient::~WebMediaStreamCenterClient):
* public/platform/WebMediaStreamComponent.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebKit):
(WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::~WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::isNull):
* public/platform/WebMediaStreamDescriptor.h:
(WebKit):
(WebMediaStreamDescriptor):
* public/platform/WebMediaStreamSourcesRequest.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebCore):
(WebKit):
(WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::~WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::isNull):
* src/UserMediaClientImpl.h:
(UserMediaClientImpl):
* src/WebMediaStreamComponent.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
(WebKit::WebMediaStreamComponent::operator=):
(WebKit::WebMediaStreamComponent::reset):
(WebKit::WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>):
(WebKit::WebMediaStreamComponent::operator MediaStreamComponent*):
(WebKit::WebMediaStreamComponent::isEnabled):
(WebKit::WebMediaStreamComponent::source):
* src/WebMediaStreamDescriptor.cpp:
(WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor):
(WebKit):
(WebKit::WebMediaStreamDescriptor::audioSources):
(WebKit::WebMediaStreamDescriptor::videoSources):
* src/WebMediaStreamSourcesRequest.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
(WebKit):
(WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
(WebKit::WebMediaStreamSourcesRequest::reset):
(WebKit::WebMediaStreamSourcesRequest::audio):
(WebKit::WebMediaStreamSourcesRequest::video):
(WebKit::WebMediaStreamSourcesRequest::didCompleteQuery):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106581
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-02 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
+ https://bugs.webkit.org/show_bug.cgi?id=73130
+
+ Reviewed by Darin Fisher.
+
+ Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.
+
+ * mediastream/UserMediaClient.h:
+ (UserMediaClient):
+ * mediastream/UserMediaRequest.cpp:
+ (WebCore::UserMediaRequest::didCompleteQuery):
+ * mediastream/UserMediaRequest.h:
+ (UserMediaRequest):
+ (WebCore::UserMediaRequest::audio):
+ (WebCore::UserMediaRequest::video):
+ (WebCore::UserMediaRequest::cameraPreferenceUser):
+ (WebCore::UserMediaRequest::cameraPreferenceEnvironment):
+ * platform/mediastream/MediaStreamCenter.cpp:
+ (WebCore):
+ (WebCore::MediaStreamCenter::queryMediaStreamSources):
+ * platform/mediastream/MediaStreamCenter.h:
+ (WebCore):
+ (MediaStreamSourcesQueryClient):
+ (MediaStreamCenter):
+
2012-02-02 Raymond Toy <rtoy@google.com>
Constant values to set "distanceModel" are undefined
public:
virtual void pageDestroyed() = 0;
- virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector&, const MediaStreamSourceVector&) = 0;
+ virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
virtual void cancelUserMediaRequest(UserMediaRequest*) = 0;
protected:
MediaStreamCenter::instance().queryMediaStreamSources(this);
}
-void UserMediaRequest::mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
+void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
{
if (m_client)
m_client->requestUserMedia(this, audioSources, videoSources);
static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
~UserMediaRequest();
- bool audio() const { return m_audio; }
- bool video() const { return m_video; }
-
- bool cameraPreferenceUser() const { return m_cameraPreferenceUser; }
- bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; }
-
NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); }
NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallback.get(); }
void start();
- void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
void succeed(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
void fail();
+ // MediaStreamSourcesQueryClient
+ virtual bool audio() const { return m_audio; }
+ virtual bool video() const { return m_video; }
+ virtual bool cameraPreferenceUser() const { return m_cameraPreferenceUser; }
+ virtual bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; }
+ virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+
// ContextDestructionObserver
virtual void contextDestroyed();
streamDescriptor->setEnded();
}
-// FIXME: remove when real implementations are available
-// Empty implementations for ports that build with MEDIA_STREAM enabled by default.
+#if !PLATFORM(CHROMIUM)
+
+// Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
MediaStreamCenter::MediaStreamCenter()
{
void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
{
MediaStreamSourceVector audioSources, videoSources;
- client->mediaStreamSourcesQueryCompleted(audioSources, videoSources);
+ client->didCompleteQuery(audioSources, videoSources);
}
void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
{
}
+#endif // !PLATFORM(CHROMIUM)
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
namespace WebCore {
+#if PLATFORM(CHROMIUM)
+class MediaStreamCenterInternal;
+#endif
+
class MediaStreamComponent;
class MediaStreamDescriptor;
virtual bool audio() const = 0;
virtual bool video() const = 0;
+ virtual bool cameraPreferenceUser() const = 0;
+ virtual bool cameraPreferenceEnvironment() const = 0;
- virtual void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
+ virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
};
class MediaStreamCenter {
private:
MediaStreamCenter();
+
+#if PLATFORM(CHROMIUM)
+ OwnPtr<MediaStreamCenterInternal> m_private;
+#endif
};
} // namespace WebCore
+2012-02-02 Tommy Widenflycht <tommyw@google.com>
+
+ [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
+ https://bugs.webkit.org/show_bug.cgi?id=73130
+
+ Reviewed by Darin Fisher.
+
+ * WebKit.gyp:
+ * bridge/MediaStreamCenter.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebCore):
+ (WebCore::MediaStreamCenter::MediaStreamCenter):
+ (WebCore::MediaStreamCenter::~MediaStreamCenter):
+ (WebCore::MediaStreamCenter::queryMediaStreamSources):
+ (WebCore::MediaStreamCenter::didSetMediaStreamTrackEnabled):
+ (WebCore::MediaStreamCenter::didStopLocalMediaStream):
+ (WebCore::MediaStreamCenter::didConstructMediaStream):
+ * bridge/MediaStreamCenterInternal.cpp: Added.
+ (WebCore):
+ (WebCore::MediaStreamCenterInternal::MediaStreamCenterInternal):
+ (WebCore::MediaStreamCenterInternal::~MediaStreamCenterInternal):
+ (WebCore::MediaStreamCenterInternal::queryMediaStreamSources):
+ (WebCore::MediaStreamCenterInternal::didSetMediaStreamTrackEnabled):
+ (WebCore::MediaStreamCenterInternal::didStopLocalMediaStream):
+ (WebCore::MediaStreamCenterInternal::didConstructMediaStream):
+ (WebCore::MediaStreamCenterInternal::stopLocalMediaStream):
+ * bridge/MediaStreamCenterInternal.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebKit):
+ (WebCore):
+ (MediaStreamCenterInternal):
+ * public/platform/WebKitPlatformSupport.h:
+ (WebKit):
+ (WebKit::WebKitPlatformSupport::createMediaStreamCenter):
+ * public/platform/WebMediaStreamCenter.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebKit):
+ (WebMediaStreamCenter):
+ (WebKit::WebMediaStreamCenter::~WebMediaStreamCenter):
+ * public/platform/WebMediaStreamCenterClient.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebKit):
+ (WebMediaStreamCenterClient):
+ (WebKit::WebMediaStreamCenterClient::~WebMediaStreamCenterClient):
+ * public/platform/WebMediaStreamComponent.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebCore):
+ (WebKit):
+ (WebMediaStreamComponent):
+ (WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
+ (WebKit::WebMediaStreamComponent::~WebMediaStreamComponent):
+ (WebKit::WebMediaStreamComponent::isNull):
+ * public/platform/WebMediaStreamDescriptor.h:
+ (WebKit):
+ (WebMediaStreamDescriptor):
+ * public/platform/WebMediaStreamSourcesRequest.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebCore):
+ (WebKit):
+ (WebMediaStreamSourcesRequest):
+ (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
+ (WebKit::WebMediaStreamSourcesRequest::~WebMediaStreamSourcesRequest):
+ (WebKit::WebMediaStreamSourcesRequest::isNull):
+ * src/UserMediaClientImpl.h:
+ (UserMediaClientImpl):
+ * src/WebMediaStreamComponent.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebKit):
+ (WebKit::WebMediaStreamComponent::WebMediaStreamComponent):
+ (WebKit::WebMediaStreamComponent::operator=):
+ (WebKit::WebMediaStreamComponent::reset):
+ (WebKit::WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>):
+ (WebKit::WebMediaStreamComponent::operator MediaStreamComponent*):
+ (WebKit::WebMediaStreamComponent::isEnabled):
+ (WebKit::WebMediaStreamComponent::source):
+ * src/WebMediaStreamDescriptor.cpp:
+ (WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor):
+ (WebKit):
+ (WebKit::WebMediaStreamDescriptor::audioSources):
+ (WebKit::WebMediaStreamDescriptor::videoSources):
+ * src/WebMediaStreamSourcesRequest.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h.
+ (WebKit):
+ (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest):
+ (WebKit::WebMediaStreamSourcesRequest::reset):
+ (WebKit::WebMediaStreamSourcesRequest::audio):
+ (WebKit::WebMediaStreamSourcesRequest::video):
+ (WebKit::WebMediaStreamSourcesRequest::didCompleteQuery):
+
2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed. Rolled DEPS.
'WEBKIT_IMPLEMENTATION=1',
],
'sources': [
+ 'bridge/MediaStreamCenter.cpp',
+ 'bridge/MediaStreamCenterInternal.cpp',
+ 'bridge/MediaStreamCenterInternal.h',
'bridge/PeerConnectionHandler.cpp',
'bridge/PeerConnectionHandlerInternal.cpp',
'bridge/PeerConnectionHandlerInternal.h',
'public/platform/WebLayerTreeView.h',
'public/platform/WebLayerTreeViewClient.h',
'public/platform/WebLocalizedString.h',
+ 'public/platform/WebMediaStreamCenter.h',
+ 'public/platform/WebMediaStreamComponent.h',
'public/platform/WebMediaStreamDescriptor.h',
'public/platform/WebMediaStreamSource.h',
+ 'public/platform/WebMediaStreamSourcesRequest.h',
'public/platform/WebNonCopyable.h',
'public/platform/WebPeerConnectionHandler.h',
'public/platform/WebPeerConnectionHandlerClient.h',
'src/WebMediaElement.cpp',
'src/WebMediaPlayerClientImpl.cpp',
'src/WebMediaPlayerClientImpl.h',
+ 'src/WebMediaStreamComponent.cpp',
'src/WebMediaStreamDescriptor.cpp',
'src/WebMediaStreamRegistry.cpp',
'src/WebMediaStreamSource.cpp',
+ 'src/WebMediaStreamSourcesRequest.cpp',
'src/WebNamedNodeMap.cpp',
'src/WebNetworkStateNotifier.cpp',
'src/WebNode.cpp',
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 "MediaStreamCenter.h"
+
+#include "MediaStreamCenterInternal.h"
+#include "MediaStreamDescriptor.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+MediaStreamCenter::MediaStreamCenter()
+ : m_private(adoptPtr(new MediaStreamCenterInternal(this)))
+{
+}
+
+MediaStreamCenter::~MediaStreamCenter()
+{
+}
+
+void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
+{
+ m_private->queryMediaStreamSources(client);
+}
+
+void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
+{
+ m_private->didSetMediaStreamTrackEnabled(stream, component);
+}
+
+void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
+{
+ m_private->didStopLocalMediaStream(stream);
+}
+
+void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor* stream)
+{
+ m_private->didConstructMediaStream(stream);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 "MediaStreamCenterInternal.h"
+
+#include "MediaStreamCenter.h"
+#include "MediaStreamComponent.h"
+#include "MediaStreamSource.h"
+#include "WebKit.h"
+#include "platform/WebKitPlatformSupport.h"
+#include "platform/WebMediaStreamCenter.h"
+#include "platform/WebMediaStreamComponent.h"
+#include "platform/WebMediaStreamDescriptor.h"
+#include "platform/WebMediaStreamSourcesRequest.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+MediaStreamCenterInternal::MediaStreamCenterInternal(MediaStreamCenter* owner)
+ : m_private(adoptPtr(WebKit::webKitPlatformSupport()->createMediaStreamCenter(this)))
+ , m_owner(owner)
+{
+}
+
+MediaStreamCenterInternal::~MediaStreamCenterInternal()
+{
+}
+
+void MediaStreamCenterInternal::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
+{
+ // FIXME: Remove this "short-circuit" and forward to m_private when Chrome has implemented WebMediaStreamCenter.
+ MediaStreamSourceVector audioSources, videoSources;
+ client->didCompleteQuery(audioSources, videoSources);
+}
+
+void MediaStreamCenterInternal::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)
+{
+ if (m_private) {
+ if (component->enabled())
+ m_private->didEnableMediaStreamTrack(stream, component);
+ else
+ m_private->didDisableMediaStreamTrack(stream, component);
+ }
+}
+
+void MediaStreamCenterInternal::didStopLocalMediaStream(MediaStreamDescriptor* stream)
+{
+ if (m_private)
+ m_private->didStopLocalMediaStream(stream);
+}
+
+void MediaStreamCenterInternal::didConstructMediaStream(MediaStreamDescriptor* stream)
+{
+ if (m_private)
+ m_private->didConstructMediaStream(stream);
+}
+
+void MediaStreamCenterInternal::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream)
+{
+ m_owner->endLocalMediaStream(stream);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 MediaStreamCenterInternal_h
+#define MediaStreamCenterInternal_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "platform/WebMediaStreamCenterClient.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+class WebMediaStreamCenter;
+}
+
+namespace WebCore {
+
+class MediaStreamCenter;
+class MediaStreamComponent;
+class MediaStreamDescriptor;
+class MediaStreamSourcesQueryClient;
+
+class MediaStreamCenterInternal : public WebKit::WebMediaStreamCenterClient {
+public:
+ explicit MediaStreamCenterInternal(MediaStreamCenter*);
+ ~MediaStreamCenterInternal();
+
+ void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
+ void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
+ void didStopLocalMediaStream(MediaStreamDescriptor*);
+ void didConstructMediaStream(MediaStreamDescriptor*);
+
+ // From WebKit::WebMediaStreamCenterClient.
+ virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&);
+
+private:
+ OwnPtr<WebKit::WebMediaStreamCenter> m_private;
+ MediaStreamCenter* m_owner;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // MediaStreamCenterInternal_h
class WebGraphicsContext3D;
class WebIDBFactory; // FIXME: Does this belong in platform?
class WebIDBKey; // FIXME: Does this belong in platform?
+class WebMediaStreamCenter;
+class WebMediaStreamCenterClient;
class WebMessagePortChannel; // FIXME: Does this belong in platform?
class WebMimeRegistry;
class WebPeerConnectionHandler;
// May return null if WebRTC functionality is not avaliable or out of resources.
virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; }
+ virtual WebMediaStreamCenter* createMediaStreamCenter(WebMediaStreamCenterClient*) { return 0; }
virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { }
virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { }
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 WebMediaStreamCenter_h
+#define WebMediaStreamCenter_h
+
+namespace WebKit {
+
+class WebMediaStreamComponent;
+class WebMediaStreamDescriptor;
+class WebMediaStreamSourcesRequest;
+
+class WebMediaStreamCenter {
+public:
+ virtual ~WebMediaStreamCenter() { }
+
+ virtual void queryMediaStreamSources(const WebMediaStreamSourcesRequest&) = 0;
+ virtual void didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
+ virtual void didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
+ virtual void didStopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
+ virtual void didConstructMediaStream(const WebMediaStreamDescriptor&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamCenter_h
+
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 WebMediaStreamCenterClient_h
+#define WebMediaStreamCenterClient_h
+
+namespace WebKit {
+
+class WebMediaStreamDescriptor;
+
+class WebMediaStreamCenterClient {
+public:
+ virtual ~WebMediaStreamCenterClient() { }
+
+ virtual void stopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamCenterClient_h
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 WebMediaStreamComponent_h
+#define WebMediaStreamComponent_h
+
+#include "WebCommon.h"
+#include "WebNonCopyable.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamComponent;
+}
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+class WebString;
+
+class WebMediaStreamComponent {
+public:
+ WebMediaStreamComponent() { }
+ ~WebMediaStreamComponent() { reset(); }
+
+ WEBKIT_EXPORT void reset();
+ bool isNull() const { return m_private.isNull(); }
+
+ WEBKIT_EXPORT WebMediaStreamSource source() const;
+ WEBKIT_EXPORT bool isEnabled() const;
+
+#if WEBKIT_IMPLEMENTATION
+ WebMediaStreamComponent(WebCore::MediaStreamComponent*);
+ WebMediaStreamComponent& operator=(WebCore::MediaStreamComponent*);
+ operator WTF::PassRefPtr<WebCore::MediaStreamComponent>() const;
+ operator WebCore::MediaStreamComponent*() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::MediaStreamComponent> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamComponent_h
namespace WebKit {
+class WebMediaStreamComponent;
class WebMediaStreamSource;
class WebString;
// DEPRECATED
WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const;
- WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamSource>&) const;
- WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamSource>&) const;
+ WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const;
+ WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const;
#if WEBKIT_IMPLEMENTATION
+ WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor*);
WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&);
operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const;
operator WebCore::MediaStreamDescriptor*() const;
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 WebMediaStreamSourcesRequest_h
+#define WebMediaStreamSourcesRequest_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+namespace WebCore {
+class MediaStreamSourcesQueryClient;
+}
+
+namespace WebKit {
+
+class WebMediaStreamSource;
+template <typename T> class WebVector;
+
+class WebMediaStreamSourcesRequest {
+public:
+ WebMediaStreamSourcesRequest() { }
+ ~WebMediaStreamSourcesRequest() { reset(); }
+
+ WEBKIT_EXPORT void reset();
+ bool isNull() const { return m_private.isNull(); }
+
+ WEBKIT_EXPORT bool audio() const;
+ WEBKIT_EXPORT bool video() const;
+
+ WEBKIT_EXPORT void didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const;
+
+#if WEBKIT_IMPLEMENTATION
+ WebMediaStreamSourcesRequest(const WTF::PassRefPtr<WebCore::MediaStreamSourcesQueryClient>&);
+#endif
+
+private:
+ WebPrivatePtr<WebCore::MediaStreamSourcesQueryClient> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebMediaStreamSourcesRequest_h
// WebCore::UserMediaClient ----------------------------------------------
virtual void pageDestroyed();
- virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&, const WebCore::MediaStreamSourceVector&);
+ virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& videoSources);
virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*);
private:
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 "platform/WebMediaStreamComponent.h"
+
+#include "MediaStreamComponent.h"
+#include "platform/WebMediaStreamSource.h"
+#include "platform/WebString.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebMediaStreamComponent::WebMediaStreamComponent(WebCore::MediaStreamComponent* mediaStreamComponent)
+ : m_private(mediaStreamComponent)
+{
+}
+
+WebMediaStreamComponent& WebMediaStreamComponent::operator=(WebCore::MediaStreamComponent* mediaStreamComponent)
+{
+ m_private = mediaStreamComponent;
+ return *this;
+}
+
+void WebMediaStreamComponent::reset()
+{
+ m_private.reset();
+}
+
+WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>() const
+{
+ return m_private.get();
+}
+
+WebMediaStreamComponent::operator MediaStreamComponent*() const
+{
+ return m_private.get();
+}
+
+bool WebMediaStreamComponent::isEnabled() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private.get()->enabled();
+}
+
+WebMediaStreamSource WebMediaStreamComponent::source() const
+{
+ ASSERT(!m_private.isNull());
+ return WebMediaStreamSource(m_private.get()->source());
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
#include "MediaStreamComponent.h"
#include "MediaStreamDescriptor.h"
#include "MediaStreamSource.h"
+#include "platform/WebMediaStreamComponent.h"
#include "platform/WebMediaStreamSource.h"
#include "platform/WebString.h"
#include <wtf/Vector.h>
{
}
+WebMediaStreamDescriptor::WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor* mediaStreamDescriptor)
+ : m_private(mediaStreamDescriptor)
+{
+}
+
void WebMediaStreamDescriptor::reset()
{
m_private.reset();
webSources.swap(result);
}
-void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamSource>& webSources) const
+void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamComponent>& webSources) const
{
size_t numberOfSources = m_private->numberOfAudioComponents();
- WebVector<WebMediaStreamSource> result(numberOfSources);
+ WebVector<WebMediaStreamComponent> result(numberOfSources);
for (size_t i = 0; i < numberOfSources; ++i)
- result[i] = m_private->audioComponent(i)->source();
+ result[i] = m_private->audioComponent(i);
webSources.swap(result);
}
-void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamSource>& webSources) const
+void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamComponent>& webSources) const
{
size_t numberOfSources = m_private->numberOfVideoComponents();
- WebVector<WebMediaStreamSource> result(numberOfSources);
+ WebVector<WebMediaStreamComponent> result(numberOfSources);
for (size_t i = 0; i < numberOfSources; ++i)
- result[i] = m_private->videoComponent(i)->source();
+ result[i] = m_private->videoComponent(i);
webSources.swap(result);
}
--- /dev/null
+/*
+ * 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 "platform/WebMediaStreamSourcesRequest.h"
+
+#include "MediaStreamCenter.h"
+#include "MediaStreamSource.h"
+#include "platform/WebMediaStreamSource.h"
+#include "platform/WebVector.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest(const PassRefPtr<WebCore::MediaStreamSourcesQueryClient>& queryClient)
+ : m_private(queryClient)
+{
+}
+
+void WebMediaStreamSourcesRequest::reset()
+{
+ m_private.reset();
+}
+
+bool WebMediaStreamSourcesRequest::audio() const
+{
+ ASSERT(!isNull());
+ return m_private->audio();
+}
+
+bool WebMediaStreamSourcesRequest::video() const
+{
+ ASSERT(!isNull());
+ return m_private->video();
+}
+
+void WebMediaStreamSourcesRequest::didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const
+{
+ ASSERT(!isNull());
+ MediaStreamSourceVector audio;
+ for (size_t i = 0; i < audioSources.size(); ++i) {
+ MediaStreamSource* curr = audioSources[i];
+ audio.append(curr);
+ }
+ MediaStreamSourceVector video;
+ for (size_t i = 0; i < videoSources.size(); ++i) {
+ MediaStreamSource* curr = videoSources[i];
+ video.append(curr);
+ }
+ m_private->didCompleteQuery(audio, video);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+