Diff
Modified: trunk/LayoutTests/ChangeLog (210498 => 210499)
--- trunk/LayoutTests/ChangeLog 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/LayoutTests/ChangeLog 2017-01-09 11:03:35 UTC (rev 210499)
@@ -1,3 +1,15 @@
+2017-01-09 Alejandro G. Castro <a...@igalia.com>
+
+ [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
+ https://bugs.webkit.org/show_bug.cgi?id=165316
+
+ Reviewed by Philippe Normand.
+
+ * platform/gtk/TestExpectations: Unskipped the test and moved the
+ stop one, now it does not timeout because we correctly handle the
+ ended value but still fails, we need more features in the mock
+ classes for owr.
+
2017-01-08 Filip Pizlo <fpi...@apple.com>
Unreviewed, since this test is slow it should run in fewer configurations. This resolves the
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (210498 => 210499)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2017-01-09 11:03:35 UTC (rev 210499)
@@ -310,7 +310,6 @@
webkit.org/b/79203 webaudio/mediastreamaudiodestinationnode.html [ Skip ]
webkit.org/b/79203 webaudio/mediastreamaudiosourcenode.html [ Skip ]
webkit.org/b/79203 fast/mediastream/MediaStream-video-element.html [ Skip ]
-webkit.org/b/79203 fast/mediastream/MediaStream-video-element-track-stop.html [ Skip ]
webkit.org/b/151344 fast/mediastream/MediaStream-add-ended-tracks.html [ Skip ]
webkit.org/b/151344 fast/mediastream/MediaStream-add-remove-tracks.html [ Skip ]
webkit.org/b/79203 fast/mediastream/mock-media-source.html [ Skip ]
@@ -319,6 +318,7 @@
webkit.org/b/160996 fast/mediastream/apply-constraints-advanced.html [ Skip ]
webkit.org/b/160996 fast/mediastream/apply-constraints-audio.html [ Skip ]
webkit.org/b/160996 fast/mediastream/apply-constraints-video.html [ Skip ]
+webkit.org/b/161956 fast/mediastream/MediaStream-video-element-displays-buffer.html [ Skip ]
# Proximity Events is not supported.
webkit.org/b/99060 proximity [ Failure ]
@@ -817,8 +817,6 @@
webkit.org/b/153937 http/tests/misc/detach-during-notifyDone.html [ Crash Pass ]
-webkit.org/b/161956 fast/mediastream/MediaStream-video-element-displays-buffer.html [ Timeout ]
-
webkit.org/b/131546 media/track/track-in-band.html [ Crash Timeout Failure ]
webkit.org/b/163782 media/video-played-ranges-1.html [ Crash Pass ]
Modified: trunk/Source/WebCore/ChangeLog (210498 => 210499)
--- trunk/Source/WebCore/ChangeLog 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/ChangeLog 2017-01-09 11:03:35 UTC (rev 210499)
@@ -1,3 +1,82 @@
+2017-01-09 Alejandro G. Castro <a...@igalia.com>
+
+ [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
+ https://bugs.webkit.org/show_bug.cgi?id=165316
+
+ Reviewed by Philippe Normand.
+
+ Fixed the ended support of the video element in the OWR player and
+ fixed the videoTracks support. Now the OW player properly adds and
+ removes the audio and video tracks. Added the getSettings support
+ to the mediastream interface. Solved also the size handling in
+ some of the enable/muted situations.
+
+ Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
+
+ * platform/GStreamer.cmake: Added the new
+ RealtimeMediaSourceOwr.cpp with the new code handling the
+ settings.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
+ Release the new video and audio maps that creates a relationship
+ of the mediastream tracks with the mediatracks of the video element.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
+ false when we start playing.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
+ tracks to the player so that the videoTracks API returns it, and
+ add an entry in the map to be able to restore it using the
+ mediastream track.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
+ Move some part of the stop function to this one in order to use it
+ in pause method and avoid changing the video selection in that
+ case.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
+ function disableMediaTracks and we also change teh selected
+ videoTrack.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
+ videoTrack reset the size and the selected element. In case there
+ is no media playing we Make sure we set the ended variable to true
+ and call the timeChange to modify the state of the player.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
+ Handle properly the situation when the user changed the enabled
+ value, we disable the media.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the
+ size of the source.
+ (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided
+ to make sure we return a size even when the sample is not ready
+ for gst.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
+ Added the ended attribute and the maps.
+ * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
+ (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new
+ realtime video and audio sources classes, this new classes
+ implement the settings of each type of media element.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
+ (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
+ Use the new audio and video source classes instead of the general
+ one in order to handle the settings properly.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added
+ (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the
+ subclass and return the new currentSettings attribute.
+ (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the
+ subclass initialization of the supportedSettings.
+ * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
+ (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to
+ initialize the settings before returning the value. Implemented in
+ the subclass.
+ (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints):
+ Added to initialize the supported settings of the
+ media. Implemented in the subclass.
+ (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp
+ file, implemented using the initialize functions of the subclass
+ * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added
+ this new class to handle the settings of the video elements. The
+ class initializes the settings and the supportedSettings.
+ * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added
+ this new class to handle the settings of the audio elements. The
+ class initializes the settings and the supportedSettings.
+
+
2017-01-08 Konstantin Tokarev <annu...@yandex.ru>
Introduce CPU(X86_SSE2) instead of various SSE2 checks
Modified: trunk/Source/WebCore/platform/GStreamer.cmake (210498 => 210499)
--- trunk/Source/WebCore/platform/GStreamer.cmake 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/GStreamer.cmake 2017-01-09 11:03:35 UTC (rev 210499)
@@ -16,6 +16,7 @@
platform/mediastream/openwebrtc/MediaEndpointOwr.cpp
platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp
+ platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp
platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
)
endif ()
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp (210498 => 210499)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp 2017-01-09 11:03:35 UTC (rev 210499)
@@ -56,6 +56,9 @@
if (hasVideo())
m_videoTrack->removeObserver(*this);
+ m_audioTrackMap.clear();
+ m_videoTrackMap.clear();
+
stop();
}
@@ -69,6 +72,7 @@
return;
}
+ m_ended = false;
m_paused = false;
GST_DEBUG("Connecting to live stream, descriptor: %p", m_streamPrivate.get());
@@ -84,7 +88,7 @@
{
GST_DEBUG("Pause");
m_paused = true;
- stop();
+ disableMediaTracks();
}
bool MediaPlayerPrivateGStreamerOwr::hasVideo() const
@@ -201,6 +205,9 @@
String preSelectedDevice = getenv("WEBKIT_AUDIO_DEVICE");
if (!preSelectedDevice || (preSelectedDevice == track->label())) {
m_audioTrack = track;
+ auto audioTrack = AudioTrackPrivateMediaStream::create(*m_audioTrack.get());
+ m_player->addAudioTrack(*audioTrack);
+ m_audioTrackMap.add(track->id(), audioTrack);
observeTrack = true;
}
}
@@ -210,6 +217,10 @@
String preSelectedDevice = getenv("WEBKIT_VIDEO_DEVICE");
if (!preSelectedDevice || (preSelectedDevice == track->label())) {
m_videoTrack = track;
+ auto videoTrack = VideoTrackPrivateMediaStream::create(*m_videoTrack.get());
+ m_player->addVideoTrack(*videoTrack);
+ videoTrack->setSelected(true);
+ m_videoTrackMap.add(track->id(), videoTrack);
observeTrack = true;
}
}
@@ -245,20 +256,31 @@
return true;
}
-void MediaPlayerPrivateGStreamerOwr::stop()
+void MediaPlayerPrivateGStreamerOwr::disableMediaTracks()
{
if (m_audioTrack) {
GST_DEBUG("Stop: disconnecting audio");
- g_object_set(m_audioRenderer.get(), "disabled", TRUE, nullptr);
+ g_object_set(m_audioRenderer.get(), "disabled", true, nullptr);
owr_media_renderer_set_source(OWR_MEDIA_RENDERER(m_audioRenderer.get()), nullptr);
}
+
if (m_videoTrack) {
GST_DEBUG("Stop: disconnecting video");
- g_object_set(m_videoRenderer.get(), "disabled", TRUE, nullptr);
+ g_object_set(m_videoRenderer.get(), "disabled", true, nullptr);
owr_media_renderer_set_source(OWR_MEDIA_RENDERER(m_videoRenderer.get()), nullptr);
}
}
+void MediaPlayerPrivateGStreamerOwr::stop()
+{
+ disableMediaTracks();
+ if (m_videoTrack) {
+ auto videoTrack = m_videoTrackMap.get(m_videoTrack->id());
+ if (videoTrack)
+ videoTrack->setSelected(false);
+ }
+}
+
void MediaPlayerPrivateGStreamerOwr::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (initializeGStreamerAndGStreamerDebugging()) {
@@ -327,9 +349,25 @@
}
if (&track == m_audioTrack)
- g_object_set(m_audioRenderer.get(), "disabled", TRUE, nullptr);
- else if (&track == m_videoTrack)
- g_object_set(m_videoRenderer.get(), "disabled", TRUE, nullptr);
+ g_object_set(m_audioRenderer.get(), "disabled", true, nullptr);
+ else if (&track == m_videoTrack) {
+ g_object_set(m_videoRenderer.get(), "disabled", true, nullptr);
+ auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source());
+ realTimeMediaSource.setWidth(0);
+ realTimeMediaSource.setHeight(0);
+ auto videoTrack = m_videoTrackMap.get(m_videoTrack->id());
+ if (videoTrack)
+ videoTrack->setSelected(false);
+ }
+
+ bool audioDisabled;
+ bool videoDisabled;
+ g_object_get(m_audioRenderer.get(), "disabled", &audioDisabled, nullptr);
+ g_object_get(m_videoRenderer.get(), "disabled", &videoDisabled, nullptr);
+ if (audioDisabled && videoDisabled) {
+ m_ended = true;
+ m_player->timeChanged();
+ }
}
void MediaPlayerPrivateGStreamerOwr::trackMutedChanged(MediaStreamTrackPrivate& track)
@@ -379,7 +417,17 @@
void MediaPlayerPrivateGStreamerOwr::trackEnabledChanged(MediaStreamTrackPrivate& track)
{
GST_DEBUG("%s track now %s", track.type() == RealtimeMediaSource::Audio ? "audio":"video", track.enabled() ? "enabled":"disabled");
- maybeHandleChangeMutedState(track);
+
+ switch (track.type()) {
+ case RealtimeMediaSource::Audio:
+ g_object_set(m_audioRenderer.get(), "disabled", !track.enabled(), nullptr);
+ break;
+ case RealtimeMediaSource::Video:
+ g_object_set(m_videoRenderer.get(), "disabled", !track.enabled(), nullptr);
+ break;
+ case RealtimeMediaSource::None:
+ GST_WARNING("Trying to change enabled state of a track with None type");
+ }
}
GstElement* MediaPlayerPrivateGStreamerOwr::createVideoSink()
@@ -426,8 +474,28 @@
MediaPlayerPrivateGStreamerBase::setSize(size);
if (m_videoRenderer)
g_object_set(m_videoRenderer.get(), "width", size.width(), "height", size.height(), nullptr);
+
+ if (!m_videoTrack)
+ return;
+
+ auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source());
+ realTimeMediaSource.setWidth(size.width());
+ realTimeMediaSource.setHeight(size.height());
}
+FloatSize MediaPlayerPrivateGStreamerOwr::naturalSize() const
+{
+ auto size = MediaPlayerPrivateGStreamerBase::naturalSize();
+
+ // In case we are not playing the video we return the size we set to the media source.
+ if (m_videoTrack && size.isZero()) {
+ auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source());
+ return realTimeMediaSource.size();
+ }
+
+ return size;
+}
+
} // namespace WebCore
#endif // ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && USE(OPENWEBRTC)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h (210498 => 210499)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h 2017-01-09 11:03:35 UTC (rev 210499)
@@ -22,8 +22,10 @@
#if ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && USE(OPENWEBRTC)
+#include "AudioTrackPrivateMediaStream.h"
#include "MediaPlayerPrivateGStreamerBase.h"
#include "MediaStreamTrackPrivate.h"
+#include "VideoTrackPrivateMediaStream.h"
typedef struct _OwrGstVideoRenderer OwrGstVideoRenderer;
typedef struct _OwrGstAudioRenderer OwrGstAudioRenderer;
@@ -42,6 +44,8 @@
void setSize(const IntSize&) final;
+ FloatSize naturalSize() const final;
+
private:
GstElement* createVideoSink() final;
GstElement* audioSink() const final { return m_audioSink.get(); }
@@ -87,6 +91,7 @@
bool canLoadPoster() const final { return false; }
void setPoster(const String&) final { }
+ bool ended() const final { return m_ended; }
// MediaStreamTrackPrivate::Observer implementation.
void trackEnded(MediaStreamTrackPrivate&) final;
@@ -101,8 +106,10 @@
void loadingFailed(MediaPlayer::NetworkState error);
void stop();
void maybeHandleChangeMutedState(MediaStreamTrackPrivate&);
+ void disableMediaTracks();
bool m_paused { true };
+ bool m_ended { false };
RefPtr<MediaStreamTrackPrivate> m_videoTrack;
RefPtr<MediaStreamTrackPrivate> m_audioTrack;
GRefPtr<GstElement> m_audioSink;
@@ -109,6 +116,9 @@
RefPtr<MediaStreamPrivate> m_streamPrivate;
GRefPtr<OwrGstVideoRenderer> m_videoRenderer;
GRefPtr<OwrGstAudioRenderer> m_audioRenderer;
+
+ HashMap<String, RefPtr<AudioTrackPrivateMediaStream>> m_audioTrackMap;
+ HashMap<String, RefPtr<VideoTrackPrivateMediaStream>> m_videoTrackMap;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/openwebrtc/MediaEndpointOwr.cpp (210498 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/MediaEndpointOwr.cpp 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/MediaEndpointOwr.cpp 2017-01-09 11:03:35 UTC (rev 210499)
@@ -39,7 +39,8 @@
#include "OpenWebRTCUtilities.h"
#include "PeerConnectionStates.h"
#include "RTCDataChannelHandler.h"
-#include "RealtimeMediaSourceOwr.h"
+#include "RealtimeAudioSourceOwr.h"
+#include "RealtimeVideoSourceOwr.h"
#include <owr/owr.h>
#include <owr/owr_audio_payload.h>
#include <owr/owr_crypto_utils.h>
@@ -350,15 +351,21 @@
{
String name;
String id("not used");
+ RefPtr<RealtimeMediaSourceOwr> source;
switch (type) {
- case RealtimeMediaSource::Audio: name = "remote audio"; break;
- case RealtimeMediaSource::Video: name = "remote video"; break;
+ case RealtimeMediaSource::Audio:
+ name = "remote audio";
+ source = adoptRef(new RealtimeAudioSourceOwr(nullptr, id, type, name));
+ break;
+ case RealtimeMediaSource::Video:
+ name = "remote video";
+ source = adoptRef(new RealtimeVideoSourceOwr(nullptr, id, type, name));
+ break;
case RealtimeMediaSource::None:
ASSERT_NOT_REACHED();
}
- RefPtr<RealtimeMediaSourceOwr> source = adoptRef(new RealtimeMediaSourceOwr(nullptr, id, type, name));
m_mutedRemoteSources.set(mid, source);
return *source;
Copied: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h (from rev 210498, trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h) (0 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h 2017-01-09 11:03:35 UTC (rev 210499)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015,2016 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.
+ */
+
+#pragma once
+
+#if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#include "RealtimeMediaSourceOwr.h"
+
+namespace WebCore {
+
+class RealtimeAudioSourceOwr : public RealtimeMediaSourceOwr {
+public:
+RealtimeAudioSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name)
+ : RealtimeMediaSourceOwr(mediaSource, id, type, name)
+ {
+ }
+
+RealtimeAudioSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name)
+ : RealtimeMediaSourceOwr(id, type, name)
+ {
+ }
+
+ virtual ~RealtimeAudioSourceOwr() { }
+
+ bool applySize(const IntSize&) final { return false; }
+
+protected:
+ void initializeSettings() final {
+ if (m_currentSettings.deviceId().isEmpty())
+ m_currentSettings.setSupportedConstraits(supportedConstraints());
+
+ m_currentSettings.setDeviceId(id());
+ }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp (210498 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 2017-01-09 11:03:35 UTC (rev 210499)
@@ -40,7 +40,9 @@
#include "MediaStreamPrivate.h"
#include "NotImplemented.h"
#include "OpenWebRTCUtilities.h"
+#include "RealtimeAudioSourceOwr.h"
#include "RealtimeMediaSourceCapabilities.h"
+#include "RealtimeVideoSourceOwr.h"
#include "UUID.h"
#include <owr/owr.h>
#include <owr/owr_local.h>
@@ -149,7 +151,11 @@
ASSERT_NOT_REACHED();
}
- auto mediaSource = adoptRef(*new RealtimeMediaSourceOwr(source, id, mediaSourceType, sourceName));
+ RefPtr<RealtimeMediaSourceOwr> mediaSource;
+ if (mediaSourceType == RealtimeMediaSource::Audio)
+ mediaSource = adoptRef(new RealtimeAudioSourceOwr(source, id, mediaSourceType, sourceName));
+ else
+ mediaSource = adoptRef(new RealtimeVideoSourceOwr(source, id, mediaSourceType, sourceName));
RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(id);
if (sourceIterator == m_sourceMap.end())
@@ -156,9 +162,10 @@
m_sourceMap.add(id, mediaSource.copyRef());
if (mediaType & OWR_MEDIA_TYPE_AUDIO)
- audioSources.append(WTFMove(mediaSource));
+ audioSources.append(mediaSource.releaseNonNull());
else if (mediaType & OWR_MEDIA_TYPE_VIDEO)
- videoSources.append(WTFMove(mediaSource));
+ videoSources.append(mediaSource.releaseNonNull());
+
}
if (videoSources.isEmpty() && audioSources.isEmpty())
Copied: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp (from rev 210498, trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h) (0 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp 2017-01-09 11:03:35 UTC (rev 210499)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016 Igalia S.L
+ *
+ * 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 ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+#include "RealtimeMediaSourceOwr.h"
+
+namespace WebCore {
+
+const RealtimeMediaSourceSettings& RealtimeMediaSourceOwr::settings() const
+{
+ const_cast<RealtimeMediaSourceOwr&>(*this).initializeSettings();
+ return m_currentSettings;
+}
+
+RealtimeMediaSourceSupportedConstraints& RealtimeMediaSourceOwr::supportedConstraints()
+{
+ if (m_supportedConstraints.supportsDeviceId())
+ return m_supportedConstraints;
+
+ m_supportedConstraints.setSupportsDeviceId(true);
+ initializeSupportedConstraints(m_supportedConstraints);
+
+ return m_supportedConstraints;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
Modified: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h (210498 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h 2017-01-09 05:35:14 UTC (rev 210498)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h 2017-01-09 11:03:35 UTC (rev 210499)
@@ -73,13 +73,20 @@
}
RefPtr<RealtimeMediaSourceCapabilities> capabilities() const override { return m_capabilities; }
- const RealtimeMediaSourceSettings& settings() const override { return m_currentSettings; }
+ const RealtimeMediaSourceSettings& settings() const override;
OwrMediaSource* mediaSource() const { return m_mediaSource; }
+protected:
+ virtual void initializeSettings() { };
+ virtual void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints&) { };
+ RealtimeMediaSourceSupportedConstraints& supportedConstraints();
+
+ RealtimeMediaSourceSettings m_currentSettings;
+
private:
+ RealtimeMediaSourceSupportedConstraints m_supportedConstraints;
RefPtr<RealtimeMediaSourceCapabilities> m_capabilities;
- RealtimeMediaSourceSettings m_currentSettings;
OwrMediaSource* m_mediaSource;
};
Copied: trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h (from rev 210498, trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h) (0 => 210499)
--- trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h 2017-01-09 11:03:35 UTC (rev 210499)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2015,2016 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.
+ */
+
+#pragma once
+
+#if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)
+
+#include "RealtimeMediaSourceOwr.h"
+
+namespace WebCore {
+
+class RealtimeVideoSourceOwr : public RealtimeMediaSourceOwr {
+public:
+RealtimeVideoSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name)
+ : RealtimeMediaSourceOwr(mediaSource, id, type, name)
+ {
+ }
+
+RealtimeVideoSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name)
+ : RealtimeMediaSourceOwr(id, type, name)
+ {
+ }
+
+ virtual ~RealtimeVideoSourceOwr() { }
+
+ bool applySize(const IntSize&) final { return true; }
+
+protected:
+ void initializeSettings() final {
+ if (m_currentSettings.deviceId().isEmpty())
+ m_currentSettings.setSupportedConstraits(supportedConstraints());
+
+ m_currentSettings.setDeviceId(id());
+
+ m_currentSettings.setFrameRate(frameRate());
+ m_currentSettings.setWidth(size().width());
+ m_currentSettings.setHeight(size().height());
+ }
+
+ void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints) final {
+ supportedConstraints.setSupportsFacingMode(RealtimeMediaSourceSettings::Unknown);
+ supportedConstraints.setSupportsWidth(true);
+ supportedConstraints.setSupportsHeight(true);
+ supportedConstraints.setSupportsAspectRatio(true);
+ supportedConstraints.setSupportsFrameRate(true);
+ }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC)