- Revision
- 278728
- Author
- [email protected]
- Date
- 2021-06-10 13:50:40 -0700 (Thu, 10 Jun 2021)
Log Message
[MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames().
https://bugs.webkit.org/show_bug.cgi?id=226867
Patch by Toshio Ogasawara <[email protected]> on 2021-06-10
Reviewed by Eric Carlson.
Source/WebCore:
SourceBufferPrivate::evictCodedFrames() now starts with the earliest PTS value
in trackBuffer instead of MediaTime::zeroTime() to avoid unnecessary loops.
Test: media/media-source/media-source-evict-codedframe-large-currenttime.html
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::evictCodedFrames):
LayoutTests:
* media/media-source/media-source-evict-codedframe-large-currenttime-expected.txt: Added.
* media/media-source/media-source-evict-codedframe-large-currenttime.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (278727 => 278728)
--- trunk/LayoutTests/ChangeLog 2021-06-10 20:47:16 UTC (rev 278727)
+++ trunk/LayoutTests/ChangeLog 2021-06-10 20:50:40 UTC (rev 278728)
@@ -1,3 +1,13 @@
+2021-06-10 Toshio Ogasawara <[email protected]>
+
+ [MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames().
+ https://bugs.webkit.org/show_bug.cgi?id=226867
+
+ Reviewed by Eric Carlson.
+
+ * media/media-source/media-source-evict-codedframe-large-currenttime-expected.txt: Added.
+ * media/media-source/media-source-evict-codedframe-large-currenttime.html: Added.
+
2021-06-10 Truitt Savell <[email protected]>
Skip tiled-drawing/scrolling/non-fast-region/wheel-event-plugin.html for arm64
Added: trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime-expected.txt (0 => 278728)
--- trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime-expected.txt 2021-06-10 20:50:40 UTC (rev 278728)
@@ -0,0 +1,8 @@
+
+EVENT(sourceopen)
+EVENT(updateend)
+EXPECTED (bufferedRanges() == '[ 200000000...200000056 ]') OK
+EXPECTED (video.currentTime == '200000040') OK
+EXPECTED (bufferedRanges() == '[ 200000010...200000057 ]') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime.html (0 => 278728)
--- trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-evict-codedframe-large-currenttime.html 2021-06-10 20:50:40 UTC (rev 278728)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>media-source-evict-codedframe-large-currenttime</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+
+ function bufferedRanges() {
+ var bufferedRanges = '[ ';
+ var timeRanges = sourceBuffer.buffered;
+ for (var i = 0 ; i < timeRanges.length ; i++) {
+ if (i)
+ bufferedRanges += ', ';
+ bufferedRanges += timeRanges.start(i) + '...' + timeRanges.end(i);
+ }
+ bufferedRanges += ' ]';
+ return bufferedRanges;
+ }
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ window.addEventListener('load', async() => {
+ findMediaElement();
+ source = new MediaSource();
+
+ const videoSource = document.createElement('source');
+ videoSource.type = 'video/mock; codecs=mock';
+ videoSource.src = ""
+ video.appendChild(videoSource);
+
+ await waitFor(source, 'sourceopen');
+ sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock");
+ initSegment = makeAInit(350, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ sourceBuffer.appendBuffer(initSegment);
+ await waitFor(sourceBuffer, 'updateend');
+ waitFor(sourceBuffer, 'error');
+
+ var offset = 200000000;
+ var firstPts = 0 + offset;
+ var lastPts = 55 + offset;
+
+ internals.settings.setMaximumSourceBufferSize(4000);
+
+ for (var pts = firstPts; pts <= lastPts; pts++) {
+ sourceBuffer.appendBuffer(makeASample(pts, pts, 1, 1, 1, SAMPLE_FLAG.SYNC, 1));
+ await waitFor(sourceBuffer, 'updateend', true);
+ }
+ testExpected('bufferedRanges()', '[ 200000000...200000056 ]', '==');
+
+ video.currentTime = 40 + offset;
+ testExpected('video.currentTime', 40 + offset, '==');
+
+ sourceBuffer.addEventListener('updateend', function() {
+ testExpected('bufferedRanges()', '[ 200000010...200000057 ]', '==');
+ endTest();
+ });
+
+ setTimeout(function() {
+ consoleWrite('* Timeout: taking too long to evict coded frames.');
+ failTest();
+ }, 50);
+
+ sourceBuffer.appendBuffer(makeASample(lastPts + 1, lastPts + 1, 1, 1, 1, SAMPLE_FLAG.SYNC, 1));
+ });
+ </script>
+</head>
+<body>
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (278727 => 278728)
--- trunk/Source/WebCore/ChangeLog 2021-06-10 20:47:16 UTC (rev 278727)
+++ trunk/Source/WebCore/ChangeLog 2021-06-10 20:50:40 UTC (rev 278728)
@@ -1,3 +1,18 @@
+2021-06-10 Toshio Ogasawara <[email protected]>
+
+ [MSE] When currentTime is a large value, it takes time to process SourceBufferPrivate::evictCodedFrames().
+ https://bugs.webkit.org/show_bug.cgi?id=226867
+
+ Reviewed by Eric Carlson.
+
+ SourceBufferPrivate::evictCodedFrames() now starts with the earliest PTS value
+ in trackBuffer instead of MediaTime::zeroTime() to avoid unnecessary loops.
+
+ Test: media/media-source/media-source-evict-codedframe-large-currenttime.html
+
+ * platform/graphics/SourceBufferPrivate.cpp:
+ (WebCore::SourceBufferPrivate::evictCodedFrames):
+
2021-06-10 Andres Gonzalez <[email protected]>
iOS - VoiceOver reads the programmatically associated label instead of the accessible name provided via the aria-label or aria-labelledby attribute
Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (278727 => 278728)
--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-06-10 20:47:16 UTC (rev 278727)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-06-10 20:50:40 UTC (rev 278728)
@@ -653,7 +653,20 @@
DEBUG_LOG(LOGIDENTIFIER, "currentTime = ", currentTime, ", require ", initialBufferedSize + newDataSize, " bytes, maximum buffer size is ", maximumBufferSize);
#endif
- MediaTime rangeStart = MediaTime::zeroTime();
+ MediaTime rangeStart = MediaTime::invalidTime();
+
+ for (auto& trackBuffer : m_trackBufferMap.values()) {
+ auto iter = trackBuffer.get().samples.presentationOrder().findSampleContainingOrAfterPresentationTime(MediaTime::zeroTime());
+ if (iter != trackBuffer.get().samples.presentationOrder().end()) {
+ MediaTime startTime = iter->first;
+ if (rangeStart.isInvalid() || startTime < rangeStart)
+ rangeStart = startTime;
+ }
+ }
+
+ if (rangeStart.isInvalid())
+ rangeStart = MediaTime::zeroTime();
+
MediaTime rangeEnd = rangeStart + thirtySeconds;
while (rangeStart < maximumRangeEnd) {
// 4. For each range in removal ranges, run the coded frame removal algorithm with start and