Changeset 247407 in webkit
- Timestamp:
- Jul 12, 2019 5:05:18 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247399 r247407 1 2019-07-12 Thibault Saunier <tsaunier@igalia.com> 2 3 [GStreamer] Mock GStreamer realtime sources should keep a Ref of their mock realtime media sources 4 https://bugs.webkit.org/show_bug.cgi?id=194326 5 6 WrappedMockRealtimeVideoSource is a subclass of RealtimeMediaSource which is refcounted, we can't 7 use a unique_ptr on those. 8 9 Also changed m_wrappedSource type to its actual type so it is cleaner even if needed 10 to upcast it to RealtimeMediaSource so some method that are made private in the mock 11 can still be called. 12 13 Reviewed by Youenn Fablet. 14 15 This fixes MediaStream tests 16 17 * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: 18 (WebCore::WrappedMockRealtimeAudioSource::create): 19 (WebCore::WrappedMockRealtimeAudioSource::asRealtimeMediaSource): 20 (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource): 21 (WebCore::m_wrappedSource): 22 (WebCore::MockGStreamerAudioCaptureSource::startProducingData): 23 (WebCore::MockGStreamerAudioCaptureSource::settings): 24 (WebCore::MockGStreamerAudioCaptureSource::capabilities): 25 * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h: 26 * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: 27 (WebCore::WrappedMockRealtimeVideoSource::create): 28 (WebCore::WrappedMockRealtimeVideoSource::asRealtimeMediaSource): 29 (WebCore::WrappedMockRealtimeVideoSource::WrappedMockRealtimeVideoSource): 30 (WebCore::m_wrappedSource): 31 (WebCore::MockGStreamerVideoCaptureSource::settings): 32 (WebCore::MockGStreamerVideoCaptureSource::capabilities): 33 * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: 34 1 35 2019-07-12 Alex Christensen <achristensen@webkit.org> 2 36 -
trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp
r241145 r247407 42 42 class WrappedMockRealtimeAudioSource : public MockRealtimeAudioSource { 43 43 public: 44 WrappedMockRealtimeAudioSource(String&& deviceID, String&& name, String&& hashSalt) 45 : MockRealtimeAudioSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)) 46 , m_src(nullptr) 47 { 44 static Ref<WrappedMockRealtimeAudioSource> create(String&& deviceID, String&& name, String&& hashSalt) 45 { 46 return adoptRef(*new WrappedMockRealtimeAudioSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt))); 47 } 48 49 RealtimeMediaSource& asRealtimeMediaSource() 50 { 51 return *this; 48 52 } 49 53 … … 129 133 uint64_t m_samplesEmitted { 0 }; 130 134 uint64_t m_samplesRendered { 0 }; 135 136 private: 137 WrappedMockRealtimeAudioSource(String&& deviceID, String&& name, String&& hashSalt) 138 : MockRealtimeAudioSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)) 139 { 140 } 131 141 }; 132 142 … … 155 165 MockGStreamerAudioCaptureSource::MockGStreamerAudioCaptureSource(String&& deviceID, String&& name, String&& hashSalt) 156 166 : GStreamerAudioCaptureSource(String { deviceID }, String { name }, String { hashSalt }) 157 , m_wrappedSource( std::make_unique<WrappedMockRealtimeAudioSource>(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)))167 , m_wrappedSource(WrappedMockRealtimeAudioSource::create(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt))) 158 168 { 159 169 m_wrappedSource->addObserver(*this); … … 175 185 { 176 186 GStreamerAudioCaptureSource::startProducingData(); 177 static_cast<WrappedMockRealtimeAudioSource *>(m_wrappedSource.get())->start(capturer()->source());187 static_cast<WrappedMockRealtimeAudioSource&>(m_wrappedSource.get()).start(capturer()->source()); 178 188 } 179 189 180 190 const RealtimeMediaSourceSettings& MockGStreamerAudioCaptureSource::settings() 181 191 { 182 return m_wrappedSource-> settings();192 return m_wrappedSource->asRealtimeMediaSource().settings(); 183 193 } 184 194 185 195 const RealtimeMediaSourceCapabilities& MockGStreamerAudioCaptureSource::capabilities() 186 196 { 187 m_capabilities = m_wrappedSource-> capabilities();188 m_currentSettings = m_wrappedSource-> settings();189 return m_wrappedSource-> capabilities();197 m_capabilities = m_wrappedSource->asRealtimeMediaSource().capabilities(); 198 m_currentSettings = m_wrappedSource->asRealtimeMediaSource().settings(); 199 return m_wrappedSource->asRealtimeMediaSource().capabilities(); 190 200 } 191 201 -
trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h
r241145 r247407 28 28 namespace WebCore { 29 29 30 class WrappedMockRealtimeAudioSource; 30 31 class MockGStreamerAudioCaptureSource final : public GStreamerAudioCaptureSource, RealtimeMediaSource::Observer { 31 32 public: … … 40 41 const RealtimeMediaSourceSettings& settings() final; 41 42 const RealtimeMediaSourceCapabilities& capabilities() final; 43 void captureFailed() final; 44 void videoSampleAvailable(MediaSample&) final { }; 42 45 43 void captureFailed(); 44 std::unique_ptr<RealtimeMediaSource> m_wrappedSource; 45 46 void videoSampleAvailable(MediaSample&) override { }; 46 Ref<WrappedMockRealtimeAudioSource> m_wrappedSource; 47 47 }; 48 48 -
trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp
r241145 r247407 34 34 class WrappedMockRealtimeVideoSource : public MockRealtimeVideoSource { 35 35 public: 36 WrappedMockRealtimeVideoSource(String&& deviceID, String&& name, String&& hashSalt) 37 : MockRealtimeVideoSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)) 36 static Ref<WrappedMockRealtimeVideoSource> create(String&& deviceID, String&& name, String&& hashSalt) 38 37 { 38 return adoptRef(*new WrappedMockRealtimeVideoSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt))); 39 } 40 41 RealtimeMediaSource& asRealtimeMediaSource() 42 { 43 return *this; 39 44 } 40 45 … … 59 64 60 65 videoSampleAvailable(MediaSampleGStreamer::create(WTFMove(gstSample), FloatSize(), String())); 66 } 67 68 private: 69 WrappedMockRealtimeVideoSource(String&& deviceID, String&& name, String&& hashSalt) 70 : MockRealtimeVideoSource(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)) 71 { 61 72 } 62 73 }; … … 98 109 MockGStreamerVideoCaptureSource::MockGStreamerVideoCaptureSource(String&& deviceID, String&& name, String&& hashSalt) 99 110 : GStreamerVideoCaptureSource(String { deviceID }, String { name }, String { hashSalt }, "appsrc") 100 , m_wrappedSource( std::make_unique<WrappedMockRealtimeVideoSource>(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt)))111 , m_wrappedSource(WrappedMockRealtimeVideoSource::create(WTFMove(deviceID), WTFMove(name), WTFMove(hashSalt))) 101 112 { 102 113 m_wrappedSource->addObserver(*this); … … 121 132 const RealtimeMediaSourceSettings& MockGStreamerVideoCaptureSource::settings() 122 133 { 123 return m_wrappedSource-> settings();134 return m_wrappedSource->asRealtimeMediaSource().settings(); 124 135 } 125 136 126 137 const RealtimeMediaSourceCapabilities& MockGStreamerVideoCaptureSource::capabilities() 127 138 { 128 m_capabilities = m_wrappedSource-> capabilities();129 m_currentSettings = m_wrappedSource-> settings();139 m_capabilities = m_wrappedSource->asRealtimeMediaSource().capabilities(); 140 m_currentSettings = m_wrappedSource->asRealtimeMediaSource().settings(); 130 141 return m_capabilities.value(); 131 142 } -
trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h
r241145 r247407 44 44 void startProducingData() final; 45 45 const RealtimeMediaSourceSettings& settings() final; 46 std::unique_ptr<RealtimeMediaSource> m_wrappedSource;47 46 const RealtimeMediaSourceCapabilities& capabilities() final; 48 void captureFailed() override; 47 void captureFailed() final; 48 void videoSampleAvailable(MediaSample&) final; 49 49 50 void videoSampleAvailable(MediaSample&) override;50 Ref<WrappedMockRealtimeVideoSource> m_wrappedSource; 51 51 }; 52 52
Note: See TracChangeset
for help on using the changeset viewer.