Changeset 247391 in webkit
- Timestamp:
- Jul 12, 2019 10:27:53 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247388 r247391 1 2019-07-12 Youenn Fablet <youenn@apple.com> 2 3 Stopping a cloned MediaStream video track should not stop any other video track 4 https://bugs.webkit.org/show_bug.cgi?id=199635 5 6 Reviewed by Eric Carlson. 7 8 * fast/mediastream/mediastreamtrack-video-clone-expected.txt: 9 * fast/mediastream/mediastreamtrack-video-clone.html: 10 1 11 2019-07-12 Timothy Hatcher <timothy@apple.com> 2 12 -
trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-clone-expected.txt
r246644 r247391 4 4 PASS Setup for height test 5 5 PASS Setup for width+height test 6 PASS Stopping a track should not stop its clone 7 PASS Stopping a cloned track should not stop the original track 8 PASS Collecting a cloned track should not stop the original track 6 9 PASS Check cloned track settings after applying width constraints 7 10 PASS Check cloned track settings after applying width constraint to original track -
trunk/LayoutTests/fast/mediastream/mediastreamtrack-video-clone.html
r246644 r247391 4 4 <meta charset="utf-8"> 5 5 <title>Clone a video track.</title> 6 <script src="../../resources/gc.js"></script> 6 7 <script src="../../resources/testharness.js"></script> 7 8 <script src="../../resources/testharnessreport.js"></script> … … 106 107 }, "Setup for width+height test"); 107 108 109 promise_test(async (t) => { 110 const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); 111 const streamClone = stream.clone(); 112 113 video1.srcObject = streamClone; 114 stream.getVideoTracks()[0].stop(); 115 116 await video1.play(); 117 assert_equals(video1.videoWidth, 100); 118 }, "Stopping a track should not stop its clone"); 119 120 promise_test(async (t) => { 121 const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); 122 const streamClone = stream.clone(); 123 124 video1.srcObject = stream; 125 streamClone.getVideoTracks()[0].stop(); 126 127 await video1.play(); 128 assert_equals(video1.videoWidth, 100); 129 }, "Stopping a cloned track should not stop the original track"); 130 131 promise_test(async (t) => { 132 const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); 133 stream.clone().getVideoTracks()[0].stop(); 134 gc(); 135 136 video1.srcObject = stream; 137 138 await video1.play(); 139 assert_equals(video1.videoWidth, 100); 140 }, "Collecting a cloned track should not stop the original track"); 108 141 </script> 109 142 </body> -
trunk/Source/WebCore/ChangeLog
r247388 r247391 1 2019-07-12 Youenn Fablet <youenn@apple.com> 2 3 Stopping a cloned MediaStream video track should not stop any other video track 4 https://bugs.webkit.org/show_bug.cgi?id=199635 5 6 Reviewed by Eric Carlson. 7 8 In case a track is requesting its source to end, the 9 RealtimeVideoSource should request its own source to end and not stop it directly. 10 11 Also, if a track is removing itself as an observer to a RealtimeVideoSource, we should 12 stop the underlying source only if this one does not have any other observer. 13 Covered by updated test. 14 15 * platform/mediastream/RealtimeMediaSource.cpp: 16 (WebCore::RealtimeMediaSource::removeObserver): 17 * platform/mediastream/RealtimeMediaSource.h: 18 * platform/mediastream/RealtimeVideoSource.cpp: 19 (WebCore::RealtimeVideoSource::requestToEnd): 20 (WebCore::RealtimeVideoSource::stopBeingObserved): 21 * platform/mediastream/RealtimeVideoSource.h: 22 1 23 2019-07-12 Timothy Hatcher <timothy@apple.com> 2 24 -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
r247211 r247391 70 70 { 71 71 auto locker = holdLock(m_observersLock); 72 73 72 m_observers.remove(&observer); 74 73 if (m_observers.isEmpty()) 75 stop ();74 stopBeingObserved(); 76 75 } 77 76 -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h
r247211 r247391 110 110 void start(); 111 111 void stop(); 112 v oid requestToEnd(Observer& callingObserver);112 virtual void requestToEnd(Observer& callingObserver); 113 113 114 114 bool muted() const { return m_muted; } … … 233 233 virtual void stopProducingData() { } 234 234 virtual void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) { } 235 236 virtual void stopBeingObserved() { stop(); } 235 237 236 238 virtual void hasEnded() { } -
trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp
r247165 r247391 119 119 } 120 120 121 void RealtimeVideoSource::requestToEnd(RealtimeMediaSource::Observer&) 122 { 123 m_source->requestToEnd(*this); 124 } 125 126 void RealtimeVideoSource::stopBeingObserved() 127 { 128 m_source->requestToEnd(*this); 129 } 130 121 131 void RealtimeVideoSource::sourceStopped() 122 132 { -
trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h
r246644 r247391 47 47 void setSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate) final; 48 48 Ref<RealtimeMediaSource> clone() final; 49 void requestToEnd(RealtimeMediaSource::Observer& callingObserver) final; 50 void stopBeingObserved() final; 49 51 50 52 const RealtimeMediaSourceCapabilities& capabilities() final { return m_source->capabilities(); }
Note: See TracChangeset
for help on using the changeset viewer.