Changeset 209860 in webkit
- Timestamp:
- Dec 15, 2016 5:15:33 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209849 r209860 1 2016-12-15 Alejandro G. Castro <alex@igalia.com> 2 3 [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html 4 https://bugs.webkit.org/show_bug.cgi?id=165316 5 6 Reviewed by Philippe Normand. 7 8 * platform/gtk/TestExpectations: Unskipped the test and moved the 9 stop one, now it does not timeout because we correctly handle the 10 ended value but still fails, we need more features in the mock 11 classes for owr. 12 1 13 2016-12-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 14 -
trunk/LayoutTests/platform/gtk/TestExpectations
r209849 r209860 315 315 webkit.org/b/79203 webaudio/mediastreamaudiosourcenode.html [ Skip ] 316 316 webkit.org/b/79203 fast/mediastream/MediaStream-video-element.html [ Skip ] 317 webkit.org/b/79203 fast/mediastream/MediaStream-video-element-track-stop.html [ Skip ]318 317 webkit.org/b/151344 fast/mediastream/MediaStream-add-ended-tracks.html [ Skip ] 319 318 webkit.org/b/151344 fast/mediastream/MediaStream-add-remove-tracks.html [ Skip ] … … 324 323 webkit.org/b/160996 fast/mediastream/apply-constraints-audio.html [ Skip ] 325 324 webkit.org/b/160996 fast/mediastream/apply-constraints-video.html [ Skip ] 325 webkit.org/b/161956 fast/mediastream/MediaStream-video-element-displays-buffer.html [ Skip ] 326 326 327 327 # Proximity Events is not supported. … … 822 822 webkit.org/b/153937 http/tests/misc/detach-during-notifyDone.html [ Crash Pass ] 823 823 824 webkit.org/b/161956 fast/mediastream/MediaStream-video-element-displays-buffer.html [ Timeout ]825 826 824 webkit.org/b/131546 media/track/track-in-band.html [ Crash Timeout Failure ] 827 825 -
trunk/Source/WebCore/ChangeLog
r209857 r209860 1 2016-12-15 Alejandro G. Castro <alex@igalia.com> 2 3 [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html 4 https://bugs.webkit.org/show_bug.cgi?id=165316 5 6 Reviewed by Philippe Normand. 7 8 Fixed the ended support of the video element in the OWR player and 9 fixed the videoTracks support. Now the OW player properly adds and 10 removes the audio and video tracks. Added the getSettings support 11 to the mediastream interface. Solved also the size handling in 12 some of the enable/muted situations. 13 14 Unskipping fast/mediastream/MediaStream-video-element-track-stop.html. 15 16 * platform/GStreamer.cmake: Added the new 17 RealtimeMediaSourceOwr.cpp with the new code handling the 18 settings. 19 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp: 20 (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr): 21 Release the new video and audio maps that creates a relationship 22 of the mediastream tracks with the mediatracks of the video element. 23 (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to 24 false when we start playing. 25 (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media 26 tracks to the player so that the videoTracks API returns it, and 27 add an entry in the map to be able to restore it using the 28 mediastream track. 29 (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks): 30 Move some part of the stop function to this one in order to use it 31 in pause method and avoid changing the video selection in that 32 case. 33 (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the 34 function disableMediaTracks and we also change teh selected 35 videoTrack. 36 (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For 37 videoTrack reset the size and the selected element. In case there 38 is no media playing we Make sure we set the ended variable to true 39 and call the timeChange to modify the state of the player. 40 (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged): 41 Handle properly the situation when the user changed the enabled 42 value, we disable the media. 43 (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the 44 size of the source. 45 (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided 46 to make sure we return a size even when the sample is not ready 47 for gst. 48 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h: 49 Added the ended attribute and the maps. 50 * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: 51 (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new 52 realtime video and audio sources classes, this new classes 53 implement the settings of each type of media element. 54 * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: 55 (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): 56 Use the new audio and video source classes instead of the general 57 one in order to handle the settings properly. 58 * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added 59 (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the 60 subclass and return the new currentSettings attribute. 61 (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the 62 subclass initialization of the supportedSettings. 63 * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h: 64 (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to 65 initialize the settings before returning the value. Implemented in 66 the subclass. 67 (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints): 68 Added to initialize the supported settings of the 69 media. Implemented in the subclass. 70 (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp 71 file, implemented using the initialize functions of the subclass 72 * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added 73 this new class to handle the settings of the video elements. The 74 class initializes the settings and the supportedSettings. 75 * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added 76 this new class to handle the settings of the audio elements. The 77 class initializes the settings and the supportedSettings. 78 79 1 80 2016-12-15 Alex Christensen <achristensen@webkit.org> 2 81 -
trunk/Source/WebCore/platform/GStreamer.cmake
r207891 r209860 17 17 platform/mediastream/openwebrtc/MediaEndpointOwr.cpp 18 18 platform/mediastream/openwebrtc/OpenWebRTCUtilities.cpp 19 platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp 19 20 platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp 20 21 ) -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp
r209125 r209860 57 57 m_videoTrack->removeObserver(*this); 58 58 59 m_audioTrackMap.clear(); 60 m_videoTrackMap.clear(); 61 59 62 stop(); 60 63 } … … 70 73 } 71 74 75 m_ended = false; 72 76 m_paused = false; 73 77 … … 85 89 GST_DEBUG("Pause"); 86 90 m_paused = true; 87 stop();91 disableMediaTracks(); 88 92 } 89 93 … … 202 206 if (!preSelectedDevice || (preSelectedDevice == track->label())) { 203 207 m_audioTrack = track; 208 auto audioTrack = AudioTrackPrivateMediaStream::create(*m_audioTrack.get()); 209 m_player->addAudioTrack(*audioTrack); 210 m_audioTrackMap.add(track->id(), audioTrack); 204 211 observeTrack = true; 205 212 } … … 211 218 if (!preSelectedDevice || (preSelectedDevice == track->label())) { 212 219 m_videoTrack = track; 220 auto videoTrack = VideoTrackPrivateMediaStream::create(*m_videoTrack.get()); 221 m_player->addVideoTrack(*videoTrack); 222 videoTrack->setSelected(true); 223 m_videoTrackMap.add(track->id(), videoTrack); 213 224 observeTrack = true; 214 225 } … … 246 257 } 247 258 248 void MediaPlayerPrivateGStreamerOwr:: stop()259 void MediaPlayerPrivateGStreamerOwr::disableMediaTracks() 249 260 { 250 261 if (m_audioTrack) { 251 262 GST_DEBUG("Stop: disconnecting audio"); 252 g_object_set(m_audioRenderer.get(), "disabled", TRUE, nullptr);263 g_object_set(m_audioRenderer.get(), "disabled", true, nullptr); 253 264 owr_media_renderer_set_source(OWR_MEDIA_RENDERER(m_audioRenderer.get()), nullptr); 254 265 } 266 255 267 if (m_videoTrack) { 256 268 GST_DEBUG("Stop: disconnecting video"); 257 g_object_set(m_videoRenderer.get(), "disabled", TRUE, nullptr);269 g_object_set(m_videoRenderer.get(), "disabled", true, nullptr); 258 270 owr_media_renderer_set_source(OWR_MEDIA_RENDERER(m_videoRenderer.get()), nullptr); 271 } 272 } 273 274 void MediaPlayerPrivateGStreamerOwr::stop() 275 { 276 disableMediaTracks(); 277 if (m_videoTrack) { 278 auto videoTrack = m_videoTrackMap.get(m_videoTrack->id()); 279 if (videoTrack) 280 videoTrack->setSelected(false); 259 281 } 260 282 } … … 328 350 329 351 if (&track == m_audioTrack) 330 g_object_set(m_audioRenderer.get(), "disabled", TRUE, nullptr); 331 else if (&track == m_videoTrack) 332 g_object_set(m_videoRenderer.get(), "disabled", TRUE, nullptr); 352 g_object_set(m_audioRenderer.get(), "disabled", true, nullptr); 353 else if (&track == m_videoTrack) { 354 g_object_set(m_videoRenderer.get(), "disabled", true, nullptr); 355 auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source()); 356 realTimeMediaSource.setWidth(0); 357 realTimeMediaSource.setHeight(0); 358 auto videoTrack = m_videoTrackMap.get(m_videoTrack->id()); 359 if (videoTrack) 360 videoTrack->setSelected(false); 361 } 362 363 bool audioDisabled; 364 bool videoDisabled; 365 g_object_get(m_audioRenderer.get(), "disabled", &audioDisabled, nullptr); 366 g_object_get(m_videoRenderer.get(), "disabled", &videoDisabled, nullptr); 367 if (audioDisabled && videoDisabled) { 368 m_ended = true; 369 m_player->timeChanged(); 370 } 333 371 } 334 372 … … 380 418 { 381 419 GST_DEBUG("%s track now %s", track.type() == RealtimeMediaSource::Audio ? "audio":"video", track.enabled() ? "enabled":"disabled"); 382 maybeHandleChangeMutedState(track); 420 421 switch (track.type()) { 422 case RealtimeMediaSource::Audio: 423 g_object_set(m_audioRenderer.get(), "disabled", !track.enabled(), nullptr); 424 break; 425 case RealtimeMediaSource::Video: 426 g_object_set(m_videoRenderer.get(), "disabled", !track.enabled(), nullptr); 427 break; 428 case RealtimeMediaSource::None: 429 GST_WARNING("Trying to change enabled state of a track with None type"); 430 } 383 431 } 384 432 … … 427 475 if (m_videoRenderer) 428 476 g_object_set(m_videoRenderer.get(), "width", size.width(), "height", size.height(), nullptr); 477 478 auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source()); 479 realTimeMediaSource.setWidth(size.width()); 480 realTimeMediaSource.setHeight(size.height()); 481 } 482 483 FloatSize MediaPlayerPrivateGStreamerOwr::naturalSize() const 484 { 485 auto size = MediaPlayerPrivateGStreamerBase::naturalSize(); 486 487 // In case we are not playing the video we return the size we set to the media source. 488 if (size.isZero()) { 489 auto& realTimeMediaSource = static_cast<RealtimeMediaSourceOwr&>(m_videoTrack->source()); 490 return realTimeMediaSource.size(); 491 } 492 493 return size; 429 494 } 430 495 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h
r208943 r209860 23 23 #if ENABLE(VIDEO) && ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && USE(OPENWEBRTC) 24 24 25 #include "AudioTrackPrivateMediaStream.h" 25 26 #include "MediaPlayerPrivateGStreamerBase.h" 26 27 #include "MediaStreamTrackPrivate.h" 28 #include "VideoTrackPrivateMediaStream.h" 27 29 28 30 typedef struct _OwrGstVideoRenderer OwrGstVideoRenderer; … … 42 44 43 45 void setSize(const IntSize&) final; 46 47 FloatSize naturalSize() const final; 44 48 45 49 private: … … 88 92 bool canLoadPoster() const final { return false; } 89 93 void setPoster(const String&) final { } 94 bool ended() const final { return m_ended; } 90 95 91 96 // MediaStreamTrackPrivate::Observer implementation. … … 102 107 void stop(); 103 108 void maybeHandleChangeMutedState(MediaStreamTrackPrivate&); 109 void disableMediaTracks(); 104 110 105 111 bool m_paused { true }; 112 bool m_ended { false }; 106 113 RefPtr<MediaStreamTrackPrivate> m_videoTrack; 107 114 RefPtr<MediaStreamTrackPrivate> m_audioTrack; … … 110 117 GRefPtr<OwrGstVideoRenderer> m_videoRenderer; 111 118 GRefPtr<OwrGstAudioRenderer> m_audioRenderer; 119 120 HashMap<String, RefPtr<AudioTrackPrivateMediaStream>> m_audioTrackMap; 121 HashMap<String, RefPtr<VideoTrackPrivateMediaStream>> m_videoTrackMap; 112 122 }; 113 123 -
trunk/Source/WebCore/platform/mediastream/openwebrtc/MediaEndpointOwr.cpp
r208944 r209860 40 40 #include "PeerConnectionStates.h" 41 41 #include "RTCDataChannelHandler.h" 42 #include "RealtimeMediaSourceOwr.h" 42 #include "RealtimeAudioSourceOwr.h" 43 #include "RealtimeVideoSourceOwr.h" 43 44 #include <owr/owr.h> 44 45 #include <owr/owr_audio_payload.h> … … 351 352 String name; 352 353 String id("not used"); 354 RefPtr<RealtimeMediaSourceOwr> source; 353 355 354 356 switch (type) { 355 case RealtimeMediaSource::Audio: name = "remote audio"; break; 356 case RealtimeMediaSource::Video: name = "remote video"; break; 357 case RealtimeMediaSource::Audio: 358 name = "remote audio"; 359 source = adoptRef(new RealtimeAudioSourceOwr(nullptr, id, type, name)); 360 break; 361 case RealtimeMediaSource::Video: 362 name = "remote video"; 363 source = adoptRef(new RealtimeVideoSourceOwr(nullptr, id, type, name)); 364 break; 357 365 case RealtimeMediaSource::None: 358 366 ASSERT_NOT_REACHED(); 359 367 } 360 368 361 RefPtr<RealtimeMediaSourceOwr> source = adoptRef(new RealtimeMediaSourceOwr(nullptr, id, type, name));362 369 m_mutedRemoteSources.set(mid, source); 363 370 -
trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h
r209859 r209860 1 1 /* 2 * Copyright (C) 2015 Igalia S.L2 * Copyright (C) 2015,2016 Igalia S.L 3 3 * Copyright (C) 2015 Metrological 4 4 * … … 33 33 */ 34 34 35 #ifndef RealtimeMediaSourceOwr_h 36 #define RealtimeMediaSourceOwr_h 35 #pragma once 37 36 38 37 #if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 39 38 40 #include "GRefPtrGStreamer.h" 41 #include "RealtimeMediaSource.h" 42 #include <owr/owr_media_source.h> 43 #include <wtf/HashMap.h> 44 #include <wtf/RefPtr.h> 45 #include <wtf/text/WTFString.h> 39 #include "RealtimeMediaSourceOwr.h" 46 40 47 41 namespace WebCore { 48 42 49 class RealtimeMediaSourceCapabilities; 50 51 class RealtimeMediaSourceOwr : public RealtimeMediaSource { 43 class RealtimeAudioSourceOwr : public RealtimeMediaSourceOwr { 52 44 public: 53 RealtimeMediaSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name) 54 : RealtimeMediaSource(id, type, name) 55 , m_mediaSource(mediaSource) 56 { 57 if (!mediaSource) 58 m_muted = true; 59 } 60 61 RealtimeMediaSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name) 62 : RealtimeMediaSource(id, type, name) 63 , m_mediaSource(nullptr) 45 RealtimeAudioSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name) 46 : RealtimeMediaSourceOwr(mediaSource, id, type, name) 64 47 { 65 48 } 66 49 67 virtual ~RealtimeMediaSourceOwr() { } 68 69 void swapOutShallowSource(OwrMediaSource& realSource) 50 RealtimeAudioSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name) 51 : RealtimeMediaSourceOwr(id, type, name) 70 52 { 71 m_mediaSource = &realSource;72 setMuted(false);73 53 } 74 54 75 virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const { return m_capabilities; } 76 virtual const RealtimeMediaSourceSettings& settings() const { return m_currentSettings; } 55 virtual ~RealtimeAudioSourceOwr() { } 77 56 78 OwrMediaSource* mediaSource() const { return m_mediaSource; }57 bool applySize(const IntSize&) final { return false; } 79 58 80 private: 81 RefPtr<RealtimeMediaSourceCapabilities> m_capabilities; 82 RealtimeMediaSourceSettings m_currentSettings; 83 OwrMediaSource* m_mediaSource; 59 protected: 60 void initializeSettings() final { 61 if (m_currentSettings.deviceId().isEmpty()) 62 m_currentSettings.setSupportedConstraits(supportedConstraints()); 63 64 m_currentSettings.setDeviceId(id()); 65 } 84 66 }; 85 86 typedef HashMap<String, RefPtr<RealtimeMediaSourceOwr>> RealtimeMediaSourceOwrMap;87 67 88 68 } // namespace WebCore 89 69 90 70 #endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 91 92 #endif // RealtimeMediaSourceOwr_h -
trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
r208687 r209860 41 41 #include "NotImplemented.h" 42 42 #include "OpenWebRTCUtilities.h" 43 #include "RealtimeAudioSourceOwr.h" 43 44 #include "RealtimeMediaSourceCapabilities.h" 45 #include "RealtimeVideoSourceOwr.h" 44 46 #include "UUID.h" 45 47 #include <owr/owr.h> … … 150 152 } 151 153 152 auto mediaSource = adoptRef(*new RealtimeMediaSourceOwr(source, id, mediaSourceType, sourceName)); 154 RefPtr<RealtimeMediaSourceOwr> mediaSource; 155 if (mediaSourceType == RealtimeMediaSource::Audio) 156 mediaSource = adoptRef(new RealtimeAudioSourceOwr(source, id, mediaSourceType, sourceName)); 157 else 158 mediaSource = adoptRef(new RealtimeVideoSourceOwr(source, id, mediaSourceType, sourceName)); 153 159 154 160 RealtimeMediaSourceOwrMap::iterator sourceIterator = m_sourceMap.find(id); … … 157 163 158 164 if (mediaType & OWR_MEDIA_TYPE_AUDIO) 159 audioSources.append( WTFMove(mediaSource));165 audioSources.append(mediaSource.releaseNonNull()); 160 166 else if (mediaType & OWR_MEDIA_TYPE_VIDEO) 161 videoSources.append(WTFMove(mediaSource)); 167 videoSources.append(mediaSource.releaseNonNull()); 168 162 169 } 163 170 -
trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp
r209859 r209860 1 1 /* 2 * Copyright (C) 2015 Igalia S.L 3 * Copyright (C) 2015 Metrological 2 * Copyright (C) 2016 Igalia S.L 4 3 * 5 4 * All rights reserved. … … 33 32 */ 34 33 35 #ifndef RealtimeMediaSourceOwr_h 36 #define RealtimeMediaSourceOwr_h 34 #include "config.h" 37 35 38 36 #if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 39 40 #include "GRefPtrGStreamer.h" 41 #include "RealtimeMediaSource.h" 42 #include <owr/owr_media_source.h> 43 #include <wtf/HashMap.h> 44 #include <wtf/RefPtr.h> 45 #include <wtf/text/WTFString.h> 37 #include "RealtimeMediaSourceOwr.h" 46 38 47 39 namespace WebCore { 48 40 49 class RealtimeMediaSourceCapabilities; 41 const RealtimeMediaSourceSettings& RealtimeMediaSourceOwr::settings() const 42 { 43 const_cast<RealtimeMediaSourceOwr&>(*this).initializeSettings(); 44 return m_currentSettings; 45 } 50 46 51 class RealtimeMediaSourceOwr : public RealtimeMediaSource { 52 public: 53 RealtimeMediaSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name) 54 : RealtimeMediaSource(id, type, name) 55 , m_mediaSource(mediaSource) 56 { 57 if (!mediaSource) 58 m_muted = true; 59 } 47 RealtimeMediaSourceSupportedConstraints& RealtimeMediaSourceOwr::supportedConstraints() 48 { 49 if (m_supportedConstraints.supportsDeviceId()) 50 return m_supportedConstraints; 60 51 61 RealtimeMediaSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name) 62 : RealtimeMediaSource(id, type, name) 63 , m_mediaSource(nullptr) 64 { 65 } 52 m_supportedConstraints.setSupportsDeviceId(true); 53 initializeSupportedConstraints(m_supportedConstraints); 66 54 67 virtual ~RealtimeMediaSourceOwr() { } 68 69 void swapOutShallowSource(OwrMediaSource& realSource) 70 { 71 m_mediaSource = &realSource; 72 setMuted(false); 73 } 74 75 virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const { return m_capabilities; } 76 virtual const RealtimeMediaSourceSettings& settings() const { return m_currentSettings; } 77 78 OwrMediaSource* mediaSource() const { return m_mediaSource; } 79 80 private: 81 RefPtr<RealtimeMediaSourceCapabilities> m_capabilities; 82 RealtimeMediaSourceSettings m_currentSettings; 83 OwrMediaSource* m_mediaSource; 84 }; 85 86 typedef HashMap<String, RefPtr<RealtimeMediaSourceOwr>> RealtimeMediaSourceOwrMap; 55 return m_supportedConstraints; 56 } 87 57 88 58 } // namespace WebCore 89 59 90 60 #endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 91 92 #endif // RealtimeMediaSourceOwr_h -
trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h
r208542 r209860 74 74 75 75 virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const { return m_capabilities; } 76 virtual const RealtimeMediaSourceSettings& settings() const { return m_currentSettings; }76 virtual const RealtimeMediaSourceSettings& settings() const; 77 77 78 78 OwrMediaSource* mediaSource() const { return m_mediaSource; } 79 79 80 protected: 81 virtual void initializeSettings() { }; 82 virtual void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints&) { }; 83 RealtimeMediaSourceSupportedConstraints& supportedConstraints(); 84 85 RealtimeMediaSourceSettings m_currentSettings; 86 80 87 private: 88 89 RealtimeMediaSourceSupportedConstraints m_supportedConstraints; 81 90 RefPtr<RealtimeMediaSourceCapabilities> m_capabilities; 82 RealtimeMediaSourceSettings m_currentSettings; 91 83 92 OwrMediaSource* m_mediaSource; 84 93 }; -
trunk/Source/WebCore/platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h
r209859 r209860 1 1 /* 2 * Copyright (C) 2015 Igalia S.L2 * Copyright (C) 2015,2016 Igalia S.L 3 3 * Copyright (C) 2015 Metrological 4 4 * … … 33 33 */ 34 34 35 #ifndef RealtimeMediaSourceOwr_h 36 #define RealtimeMediaSourceOwr_h 35 #pragma once 37 36 38 37 #if ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 39 38 40 #include "GRefPtrGStreamer.h" 41 #include "RealtimeMediaSource.h" 42 #include <owr/owr_media_source.h> 43 #include <wtf/HashMap.h> 44 #include <wtf/RefPtr.h> 45 #include <wtf/text/WTFString.h> 39 #include "RealtimeMediaSourceOwr.h" 46 40 47 41 namespace WebCore { 48 42 49 class RealtimeMediaSourceCapabilities; 50 51 class RealtimeMediaSourceOwr : public RealtimeMediaSource { 43 class RealtimeVideoSourceOwr : public RealtimeMediaSourceOwr { 52 44 public: 53 RealtimeMediaSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name) 54 : RealtimeMediaSource(id, type, name) 55 , m_mediaSource(mediaSource) 56 { 57 if (!mediaSource) 58 m_muted = true; 59 } 60 61 RealtimeMediaSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name) 62 : RealtimeMediaSource(id, type, name) 63 , m_mediaSource(nullptr) 45 RealtimeVideoSourceOwr(OwrMediaSource* mediaSource, const String& id, RealtimeMediaSource::Type type, const String& name) 46 : RealtimeMediaSourceOwr(mediaSource, id, type, name) 64 47 { 65 48 } 66 49 67 virtual ~RealtimeMediaSourceOwr() { } 68 69 void swapOutShallowSource(OwrMediaSource& realSource) 50 RealtimeVideoSourceOwr(const String& id, RealtimeMediaSource::Type type, const String& name) 51 : RealtimeMediaSourceOwr(id, type, name) 70 52 { 71 m_mediaSource = &realSource;72 setMuted(false);73 53 } 74 54 75 virtual RefPtr<RealtimeMediaSourceCapabilities> capabilities() const { return m_capabilities; } 76 virtual const RealtimeMediaSourceSettings& settings() const { return m_currentSettings; } 55 virtual ~RealtimeVideoSourceOwr() { } 77 56 78 OwrMediaSource* mediaSource() const { return m_mediaSource; }57 bool applySize(const IntSize&) final { return true; } 79 58 80 private: 81 RefPtr<RealtimeMediaSourceCapabilities> m_capabilities; 82 RealtimeMediaSourceSettings m_currentSettings; 83 OwrMediaSource* m_mediaSource; 59 protected: 60 void initializeSettings() final { 61 if (m_currentSettings.deviceId().isEmpty()) 62 m_currentSettings.setSupportedConstraits(supportedConstraints()); 63 64 m_currentSettings.setDeviceId(id()); 65 66 m_currentSettings.setFrameRate(frameRate()); 67 m_currentSettings.setWidth(size().width()); 68 m_currentSettings.setHeight(size().height()); 69 } 70 71 void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints& supportedConstraints) final { 72 supportedConstraints.setSupportsFacingMode(RealtimeMediaSourceSettings::Unknown); 73 supportedConstraints.setSupportsWidth(true); 74 supportedConstraints.setSupportsHeight(true); 75 supportedConstraints.setSupportsAspectRatio(true); 76 supportedConstraints.setSupportsFrameRate(true); 77 } 84 78 }; 85 86 typedef HashMap<String, RefPtr<RealtimeMediaSourceOwr>> RealtimeMediaSourceOwrMap;87 79 88 80 } // namespace WebCore 89 81 90 82 #endif // ENABLE(MEDIA_STREAM) && USE(OPENWEBRTC) 91 92 #endif // RealtimeMediaSourceOwr_h
Note: See TracChangeset
for help on using the changeset viewer.