Title: [262882] branches/safari-609-branch
Revision
262882
Author
alanc...@apple.com
Date
2020-06-10 17:36:02 -0700 (Wed, 10 Jun 2020)

Log Message

Cherry-pick r262841. rdar://problem/64226920

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (262881 => 262882)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-11 00:36:02 UTC (rev 262882)
@@ -1,5 +1,51 @@
 2020-06-10  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r262841. rdar://problem/64226920
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Alan Coon  <alanc...@apple.com>
+
         Apply patch. rdar://problem/64226920
 
     2020-06-10  Youenn Fablet  <you...@apple.com>

Added: branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt (0 => 262882)


--- branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted-expected.txt	2020-06-11 00:36:02 UTC (rev 262882)
@@ -0,0 +1,3 @@
+
+PASS Stopping a muted source should end it 
+

Added: branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted.html (0 => 262882)


--- branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/mediastream/track-ended-while-muted.html	2020-06-11 00:36:02 UTC (rev 262882)
@@ -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: branches/safari-609-branch/Source/WebCore/ChangeLog (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-11 00:36:02 UTC (rev 262882)
@@ -1,5 +1,65 @@
 2020-06-10  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r262841. rdar://problem/64226920
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-10  Alan Coon  <alanc...@apple.com>
+
         Apply patch. rdar://problem/64226920
 
     2020-06-10  Youenn Fablet  <you...@apple.com>

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-06-11 00:36:02 UTC (rev 262882)
@@ -214,9 +214,6 @@
 
 void RealtimeMediaSource::requestToEnd(Observer& callingObserver)
 {
-    if (!m_isProducingData)
-        return;
-
     bool hasObserverPreventingStopping = false;
     forEachObserver([&](auto& observer) {
         if (observer.preventSourceFromStopping())

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-06-11 00:36:02 UTC (rev 262882)
@@ -110,6 +110,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: branches/safari-609-branch/Source/WebCore/testing/Internals.cpp (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.cpp	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.cpp	2020-06-11 00:36:02 UTC (rev 262882)
@@ -4948,6 +4948,11 @@
     return track.source().interrupted();
 }
 
+bool Internals::isMediaStreamSourceEnded(MediaStreamTrack& track) const
+{
+    return track.source().isEnded();
+}
+
 bool Internals::isMockRealtimeMediaSourceCenterEnabled()
 {
     return MockRealtimeMediaSourceCenter::mockRealtimeMediaSourceCenterEnabled();

Modified: branches/safari-609-branch/Source/WebCore/testing/Internals.h (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.h	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.h	2020-06-11 00:36:02 UTC (rev 262882)
@@ -751,6 +751,7 @@
     void setMediaStreamTrackIdentifier(MediaStreamTrack&, String&& id);
     void setMediaStreamSourceInterrupted(MediaStreamTrack&, bool);
     bool isMediaStreamSourceInterrupted(MediaStreamTrack&) const;
+    bool isMediaStreamSourceEnded(MediaStreamTrack&) const;
     bool isMockRealtimeMediaSourceCenterEnabled();
 #endif
 

Modified: branches/safari-609-branch/Source/WebCore/testing/Internals.idl (262881 => 262882)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.idl	2020-06-11 00:35:56 UTC (rev 262881)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.idl	2020-06-11 00:36:02 UTC (rev 262882)
@@ -728,6 +728,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();
 
     unsigned long long documentIdentifier(Document document);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to