- Revision
- 262841
- Author
- you...@apple.com
- Date
- 2020-06-10 09:02:46 -0700 (Wed, 10 Jun 2020)
Log Message
REGRESSION(r262798): fast/mediastream/media-stream-track-interrupted.html is failing
https://bugs.webkit.org/show_bug.cgi?id=213011
Reviewed by Eric Carlson.
Source/WebCore:
Before the patch, a source that is muted and for which its observers get ended will not be ended.
This is a potential issue as the source can get unmuted, in which case, the audio shared unit might be asked to restart.
This is crashing in debug as we would not have the AudioSession correct category for audio capture.
Test: fast/mediastream/track-ended-while-muted.html
Also covered by fast/mediastream/media-stream-track-interrupted.html no longer flakily crashing in debug.
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::requestToEnd):
End the source even if muted.
* platform/mediastream/RealtimeMediaSource.h:
* testing/Internals.cpp:
(WebCore::Internals::isMediaStreamSourceEnded const):
* testing/Internals.h:
* testing/Internals.idl:
Add necessary test infrastructure.
LayoutTests:
* fast/mediastream/track-ended-while-muted-expected.txt: Added.
* fast/mediastream/track-ended-while-muted.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (262840 => 262841)
--- trunk/LayoutTests/ChangeLog 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/LayoutTests/ChangeLog 2020-06-10 16:02:46 UTC (rev 262841)
@@ -1,3 +1,13 @@
+2020-06-10 Youenn Fablet <you...@apple.com>
+
+ REGRESSION(r262798): fast/mediastream/media-stream-track-interrupted.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=213011
+
+ Reviewed by Eric Carlson.
+
+ * fast/mediastream/track-ended-while-muted-expected.txt: Added.
+ * fast/mediastream/track-ended-while-muted.html: Added.
+
2020-06-10 Carlos Alberto Lopez Perez <clo...@igalia.com>
Layout tests outside of the WPT import should not use resources from it
Added: trunk/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt (0 => 262841)
--- trunk/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt 2020-06-10 16:02:46 UTC (rev 262841)
@@ -0,0 +1,3 @@
+
+PASS Stopping a muted source should end it
+
Added: trunk/LayoutTests/fast/mediastream/track-ended-while-muted.html (0 => 262841)
--- trunk/LayoutTests/fast/mediastream/track-ended-while-muted.html (rev 0)
+++ trunk/LayoutTests/fast/mediastream/track-ended-while-muted.html 2020-06-10 16:02:46 UTC (rev 262841)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Capture source ended and muted.</title>
+ <script src=""
+ <script src=""
+ </head>
+<body>
+<script>
+promise_test(async (test) => {
+ const stream = await navigator.mediaDevices.getUserMedia({audio: true});
+ const track = stream.getAudioTracks()[0];
+ if (!window.internals)
+ return;
+
+ const clone = track.clone();
+
+ let promise = new Promise((resolve, reject) => { track._onmute_ = resolve; setTimeout(() => reject("no mute"), 5000) });
+ internals.setMediaStreamSourceInterrupted(track, true);
+ await promise;
+
+ track.stop();
+ assert_false(internals.isMediaStreamSourceEnded(track));
+ clone.stop();
+ assert_true(internals.isMediaStreamSourceEnded(track));
+}, "Stopping a muted source should end it");
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (262840 => 262841)
--- trunk/Source/WebCore/ChangeLog 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/ChangeLog 2020-06-10 16:02:46 UTC (rev 262841)
@@ -1,3 +1,27 @@
+2020-06-10 Youenn Fablet <you...@apple.com>
+
+ REGRESSION(r262798): fast/mediastream/media-stream-track-interrupted.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=213011
+
+ Reviewed by Eric Carlson.
+
+ Before the patch, a source that is muted and for which its observers get ended will not be ended.
+ This is a potential issue as the source can get unmuted, in which case, the audio shared unit might be asked to restart.
+ This is crashing in debug as we would not have the AudioSession correct category for audio capture.
+
+ Test: fast/mediastream/track-ended-while-muted.html
+ Also covered by fast/mediastream/media-stream-track-interrupted.html no longer flakily crashing in debug.
+
+ * platform/mediastream/RealtimeMediaSource.cpp:
+ (WebCore::RealtimeMediaSource::requestToEnd):
+ End the source even if muted.
+ * platform/mediastream/RealtimeMediaSource.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::isMediaStreamSourceEnded const):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ Add necessary test infrastructure.
+
2020-06-05 Sergio Villar Senin <svil...@igalia.com>
[WebXR] Refactor OpenXR platform code
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (262840 => 262841)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp 2020-06-10 16:02:46 UTC (rev 262841)
@@ -248,9 +248,6 @@
void RealtimeMediaSource::requestToEnd(Observer& callingObserver)
{
- if (!m_isProducingData)
- return;
-
bool hasObserverPreventingStopping = false;
forEachObserver([&](auto& observer) {
if (observer.preventSourceFromStopping())
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (262840 => 262841)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2020-06-10 16:02:46 UTC (rev 262841)
@@ -124,6 +124,7 @@
void start();
void stop();
virtual void requestToEnd(Observer& callingObserver);
+ bool isEnded() const { return m_isEnded; }
bool muted() const { return m_muted; }
void setMuted(bool);
Modified: trunk/Source/WebCore/testing/Internals.cpp (262840 => 262841)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-06-10 16:02:46 UTC (rev 262841)
@@ -5178,6 +5178,11 @@
return track.source().interrupted();
}
+bool Internals::isMediaStreamSourceEnded(MediaStreamTrack& track) const
+{
+ return track.source().isEnded();
+}
+
bool Internals::isMockRealtimeMediaSourceCenterEnabled()
{
return MockRealtimeMediaSourceCenter::mockRealtimeMediaSourceCenterEnabled();
Modified: trunk/Source/WebCore/testing/Internals.h (262840 => 262841)
--- trunk/Source/WebCore/testing/Internals.h 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/testing/Internals.h 2020-06-10 16:02:46 UTC (rev 262841)
@@ -786,6 +786,7 @@
void setMediaStreamTrackIdentifier(MediaStreamTrack&, String&& id);
void setMediaStreamSourceInterrupted(MediaStreamTrack&, bool);
bool isMediaStreamSourceInterrupted(MediaStreamTrack&) const;
+ bool isMediaStreamSourceEnded(MediaStreamTrack&) const;
bool isMockRealtimeMediaSourceCenterEnabled();
bool shouldAudioTrackPlay(const AudioTrack&);
#endif
Modified: trunk/Source/WebCore/testing/Internals.idl (262840 => 262841)
--- trunk/Source/WebCore/testing/Internals.idl 2020-06-10 15:35:24 UTC (rev 262840)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-06-10 16:02:46 UTC (rev 262841)
@@ -785,6 +785,7 @@
[Conditional=MEDIA_STREAM] void setMediaStreamTrackIdentifier(MediaStreamTrack track, DOMString identifier);
[Conditional=MEDIA_STREAM] void setMediaStreamSourceInterrupted(MediaStreamTrack track, boolean interrupted);
[Conditional=MEDIA_STREAM] boolean isMediaStreamSourceInterrupted(MediaStreamTrack track);
+ [Conditional=MEDIA_STREAM] boolean isMediaStreamSourceEnded(MediaStreamTrack track);
[Conditional=MEDIA_STREAM] boolean isMockRealtimeMediaSourceCenterEnabled();
[Conditional=MEDIA_STREAM] boolean shouldAudioTrackPlay(AudioTrack track);