Title: [227042] branches/safari-605-branch

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (227041 => 227042)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-01-17 05:05:02 UTC (rev 227041)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-01-17 05:05:05 UTC (rev 227042)
@@ -1,5 +1,20 @@
 2018-01-16  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227009. rdar://problem/36567976
+
+    2018-01-16  Jer Noble  <[email protected]>
+
+            Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
+            https://bugs.webkit.org/show_bug.cgi?id=181707
+            <rdar://problem/34809474>
+
+            Reviewed by Eric Carlson.
+
+            * media/media-source/media-source-remove-unload-crash-expected.txt: Added.
+            * media/media-source/media-source-remove-unload-crash.html: Added.
+
+2018-01-16  Jason Marcell  <[email protected]>
+
         Cherry-pick r226993. rdar://problem/36567965
 
     2018-01-16  Said Abou-Hallawa  <[email protected]>

Added: branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash-expected.txt (0 => 227042)


--- branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash-expected.txt	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash-expected.txt	2018-01-17 05:05:05 UTC (rev 227042)
@@ -0,0 +1,18 @@
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(source.duration = loader.duration())
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+Append a media segment.
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
+EVENT(update)
+Remove the SourceBuffer from its MediaSource, then unload the video element. Should not crash.
+RUN(source.removeSourceBuffer(sourceBuffer))
+RUN(sourceBuffer = null)
+RUN(gc())
+RUN(video.src = ""
+RUN(video.load())
+END OF TEST
+

Added: branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash.html (0 => 227042)


--- branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash.html	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/media/media-source/media-source-remove-unload-crash.html	2018-01-17 05:05:05 UTC (rev 227042)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-remove-unload-crash</title>
+    <script src=""
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+    var sourceBuffer;
+
+    function runTest() {
+        findMediaElement();
+
+        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+        loader._onload_ = mediaDataLoaded;
+        loader._onerror_ = mediaDataLoadingFailed;
+    }
+
+    function mediaDataLoadingFailed() {
+        failTest('Media data loading failed');
+    }
+
+    function mediaDataLoaded() {
+        source = new MediaSource();
+        waitForEvent('sourceopen', sourceOpen, false, false, source);
+        run('video.src = ""
+    }
+
+    function sourceOpen() {
+        run('source.duration = loader.duration()');
+        run('sourceBuffer = source.addSourceBuffer(loader.type())');
+        waitForEventOn(sourceBuffer, 'update', sourceInitialized, false, true);
+        run('sourceBuffer.appendBuffer(loader.initSegment())');
+    }
+
+    function sourceInitialized() {
+        consoleWrite('Append a media segment.')
+        waitForEventOn(sourceBuffer, 'update', mediaSegmentAppended, false, true);
+        run('sourceBuffer.appendBuffer(loader.mediaSegment(0))');
+    }
+
+    function mediaSegmentAppended() {
+        consoleWrite('Remove the SourceBuffer from its MediaSource, then unload the video element. Should not crash.')
+        run('source.removeSourceBuffer(sourceBuffer)');
+        run('sourceBuffer = null');
+        setTimeout(afterRemove, 100);
+    }
+
+    function afterRemove(event) {
+        run('gc()');
+        run('video.src = ""
+        run('video.load()');
+        endTest();
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+    <video controls></video>
+</body>
+</html>

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227041 => 227042)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-17 05:05:02 UTC (rev 227041)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-17 05:05:05 UTC (rev 227042)
@@ -1,5 +1,22 @@
 2018-01-16  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227009. rdar://problem/36567976
+
+    2018-01-16  Jer Noble  <[email protected]>
+
+            Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
+            https://bugs.webkit.org/show_bug.cgi?id=181707
+            <rdar://problem/34809474>
+
+            Reviewed by Eric Carlson.
+
+            Test: media/media-source/media-source-remove-unload-crash.html
+
+            * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+            (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
+
+2018-01-16  Jason Marcell  <[email protected]>
+
         Cherry-pick r227006. rdar://problem/36567998
 
     2018-01-16  Zalan Bujtas  <[email protected]>

Modified: branches/safari-605-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (227041 => 227042)


--- branches/safari-605-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm	2018-01-17 05:05:02 UTC (rev 227041)
+++ branches/safari-605-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm	2018-01-17 05:05:05 UTC (rev 227042)
@@ -80,6 +80,9 @@
 {
     ASSERT(m_sourceBuffers.contains(buffer));
 
+    if (buffer == m_sourceBufferWithSelectedVideo)
+        m_sourceBufferWithSelectedVideo = nullptr;
+
     size_t pos = m_activeSourceBuffers.find(buffer);
     if (pos != notFound) {
         m_activeSourceBuffers.remove(pos);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to