WebKit Bugzilla
Attachment 373763 Details for
Bug 199635
: Stopping a cloned MediaStream video track should not stop any other video track
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199635-20190709141350.patch (text/plain), 8.39 KB, created by
youenn fablet
on 2019-07-09 14:13:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-07-09 14:13:51 PDT
Size:
8.39 KB
patch
obsolete
>Subversion Revision: 247200 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1b7b79632e6b5c86f792e79799d074b2d68b8783..1e4d3fd568215f02a6bb0f7cae1746608aa52a1a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2019-07-09 Youenn Fablet <youenn@apple.com> >+ >+ Stopping a cloned MediaStream video track should not stop any other video track >+ https://bugs.webkit.org/show_bug.cgi?id=199635 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In case a track is requesting its source to end, the >+ RealtimeVideoSource should request its own source to end and not stop it directly. >+ >+ Also, if a track is removing itself as an observer to a RealtimeVideoSource, we should >+ stop the underlying source only if this one does not have any other observer. >+ Covered by updated test. >+ >+ * platform/mediastream/RealtimeMediaSource.cpp: >+ (WebCore::RealtimeMediaSource::removeObserver): >+ * platform/mediastream/RealtimeMediaSource.h: >+ * platform/mediastream/RealtimeVideoSource.cpp: >+ (WebCore::RealtimeVideoSource::requestToEnd): >+ (WebCore::RealtimeVideoSource::stopBeingObserved): >+ * platform/mediastream/RealtimeVideoSource.h: >+ > 2019-07-08 Youenn Fablet <youenn@apple.com> > > Hop explicitly to the main thread after generating a frame in ScreenDisplayCaptureSourceMac >diff --git a/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp b/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >index 6260e37e111adf7d2e3a2ac800ae22001a79fc57..ceee1778c3c30c9f3d2ed0c9a8ae1bedc64285ff 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp >@@ -69,10 +69,9 @@ void RealtimeMediaSource::addObserver(RealtimeMediaSource::Observer& observer) > void RealtimeMediaSource::removeObserver(RealtimeMediaSource::Observer& observer) > { > auto locker = holdLock(m_observersLock); >- > m_observers.remove(&observer); > if (m_observers.isEmpty()) >- stop(); >+ stopBeingObserved(); > } > > void RealtimeMediaSource::setInterrupted(bool interrupted, bool pageMuted) >diff --git a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >index 7ab4ab22efa4a5fd7c758cc7000ad02c407d7dbe..a83e6df8b6310fac11fab0368087548bb1828d35 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >@@ -109,7 +109,7 @@ public: > bool isProducingData() const { return m_isProducingData; } > void start(); > void stop(); >- void requestToEnd(Observer& callingObserver); >+ virtual void requestToEnd(Observer& callingObserver); > > bool muted() const { return m_muted; } > void setMuted(bool); >@@ -233,6 +233,8 @@ private: > virtual void stopProducingData() { } > virtual void settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag>) { } > >+ virtual void stopBeingObserved() { stop(); } >+ > virtual void hasEnded() { } > > #if !RELEASE_LOG_DISABLED >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >index ec9370547516e47b253717d7c2bda4c65d6093ca..b135b3ca66bd4b657932d8439ae926bdc01d5615 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp >@@ -118,6 +118,16 @@ bool RealtimeVideoSource::preventSourceFromStopping() > return hasObserverPreventingStopping; > } > >+void RealtimeVideoSource::requestToEnd(RealtimeMediaSource::Observer&) >+{ >+ m_source->requestToEnd(*this); >+} >+ >+void RealtimeVideoSource::stopBeingObserved() >+{ >+ m_source->requestToEnd(*this); >+} >+ > void RealtimeVideoSource::sourceStopped() > { > if (m_source->captureDidFail()) { >diff --git a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >index 6f79468cd0d0a0c0df7fa85758d168f798c0d511..aa3753326b64100389773d1208baf994e6480cd4 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeVideoSource.h >@@ -46,6 +46,8 @@ private: > bool supportsSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate) final; > void setSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate) final; > Ref<RealtimeMediaSource> clone() final; >+ void requestToEnd(RealtimeMediaSource::Observer& callingObserver) final; >+ void stopBeingObserved() final; > > const RealtimeMediaSourceCapabilities& capabilities() final { return m_source->capabilities(); } > const RealtimeMediaSourceSettings& settings() final { return m_currentSettings; } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d8e0e127c325ef6eb72ae9c041c9bca8587db928..864be45b1493f577e3c2f231c6fb5a446a8d7829 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2019-07-09 Youenn Fablet <youenn@apple.com> >+ >+ Stopping a cloned MediaStream video track should not stop any other video track >+ https://bugs.webkit.org/show_bug.cgi?id=199635 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/mediastream/mediastreamtrack-video-clone-expected.txt: >+ * fast/mediastream/mediastreamtrack-video-clone.html: >+ > 2019-07-08 Youenn Fablet <youenn@apple.com> > > XHR CORS requests logged twice in the server >diff --git a/LayoutTests/fast/mediastream/mediastreamtrack-video-clone-expected.txt b/LayoutTests/fast/mediastream/mediastreamtrack-video-clone-expected.txt >index c36c281e67090241778e32ac9a9e041d6e483c8f..eefda5834aedaf248e10b97533568404a560f27a 100644 >--- a/LayoutTests/fast/mediastream/mediastreamtrack-video-clone-expected.txt >+++ b/LayoutTests/fast/mediastream/mediastreamtrack-video-clone-expected.txt >@@ -3,6 +3,9 @@ > PASS Setup for width test > PASS Setup for height test > PASS Setup for width+height test >+PASS Stopping a track should not stop its clone >+PASS Stopping a cloned track should not stop the original track >+PASS Collecting a cloned track should not stop the original track > PASS Check cloned track settings after applying width constraints > PASS Check cloned track settings after applying width constraint to original track > PASS Check cloned track settings after applying height constraints >diff --git a/LayoutTests/fast/mediastream/mediastreamtrack-video-clone.html b/LayoutTests/fast/mediastream/mediastreamtrack-video-clone.html >index efdbf86d5e324a7381023e72fe95c5aaac3d13a9..a1f54de0ef486e84e7c109859f7b9de229569918 100644 >--- a/LayoutTests/fast/mediastream/mediastreamtrack-video-clone.html >+++ b/LayoutTests/fast/mediastream/mediastreamtrack-video-clone.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="utf-8"> > <title>Clone a video track.</title> >+ <script src="../../resources/gc.js"></script> > <script src="../../resources/testharness.js"></script> > <script src="../../resources/testharnessreport.js"></script> > </head> >@@ -105,6 +106,38 @@ > }, "Check cloned track settings after applying width+height constraints to original track"); > }, "Setup for width+height test"); > >+ promise_test(async (t) => { >+ const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); >+ const streamClone = stream.clone(); >+ >+ video1.srcObject = streamClone; >+ stream.getVideoTracks()[0].stop(); >+ >+ await video1.play(); >+ assert_equals(video1.videoWidth, 100); >+ }, "Stopping a track should not stop its clone"); >+ >+ promise_test(async (t) => { >+ const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); >+ const streamClone = stream.clone(); >+ >+ video1.srcObject = stream; >+ streamClone.getVideoTracks()[0].stop(); >+ >+ await video1.play(); >+ assert_equals(video1.videoWidth, 100); >+ }, "Stopping a cloned track should not stop the original track"); >+ >+ promise_test(async (t) => { >+ const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 100, height: 100 } }); >+ stream.clone().getVideoTracks()[0].stop(); >+ gc(); >+ >+ video1.srcObject = stream; >+ >+ await video1.play(); >+ assert_equals(video1.videoWidth, 100); >+ }, "Collecting a cloned track should not stop the original track"); > </script> > </body> > </html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199635
: 373763