WebKit Bugzilla
Attachment 371579 Details for
Bug 166620
: [MSE][GStreamer] Avoid QUOTA_EXCEEDED_ERR when seeking to a buffered range just before the buffered one
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-166620-20190607095449.patch (text/plain), 17.46 KB, created by
Enrique Ocaña
on 2019-06-07 02:54:50 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Enrique Ocaña
Created:
2019-06-07 02:54:50 PDT
Size:
17.46 KB
patch
obsolete
>Subversion Revision: 246103 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9e7d226de2ddffe2b80e5067f84fbf780fb64f65..d7a20d9df50ed7909f0d87b5ea414cc9c2ae30d0 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2019-06-06 Enrique Ocaña González <eocanha@igalia.com> >+ >+ [MSE][GStreamer] Avoid QUOTA_EXCEEDED_ERR when seeking to a buffered range just before the buffered one >+ https://bugs.webkit.org/show_bug.cgi?id=166620 >+ >+ Reviewed by Xabier Rodriguez-Calvar. >+ >+ This patch is fixing a seek to unbuffered range just before the buffered one. >+ For example, supposing a [120, 176) append has filled all the memory and then >+ a seek to 115.0 is done, a subsequent [115, 120) append would fail without >+ this fix. EvictCodedFrames() would return without actually evicting anything, >+ and appendBufferInternal will print "buffer full, failing with >+ QUOTA_EXCEEDED_ERR error" on GStreamer platforms instead of letting the new >+ [115, 120) append succeed. >+ >+ This patch is based on an original patch by iivlev <iivlev@productengine.com> >+ >+ Test: media/media-source/media-source-append-before-last-range-no-quota-exceeded.html >+ >+ * Modules/mediasource/SourceBuffer.cpp: >+ (WebCore::SourceBuffer::evictCodedFrames): >+ Removed the "only if there are buffered ranges *containing* the currentTime" condition >+ to enter into the second part of the eviction algorithm, which removes frames >+ starting from the duration of the media and going backwards down to currentPosition + 30. >+ The loop break condition has also been changed to deal with notFound currentTimeRange. >+ > 2019-06-01 Antoine Quint <graouts@apple.com> > > [Pointer Events] Add support for chorded button interactions >diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >index 7849ef266fc35e34ffa253468c81c828583f4507..aa8006e3c3872cc04c5615f29eefc1432ed73710 100644 >--- a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >+++ b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >@@ -991,7 +991,7 @@ void SourceBuffer::evictCodedFrames(size_t newDataSize) > // currenTime whichever we hit first. > auto buffered = m_buffered->ranges(); > size_t currentTimeRange = buffered.find(currentTime); >- if (currentTimeRange == notFound || currentTimeRange == buffered.length() - 1) { >+ if (currentTimeRange == buffered.length() - 1) { > #if !RELEASE_LOG_DISABLED > ERROR_LOG(LOGIDENTIFIER, "FAILED to free enough after evicting ", initialBufferedSize - extraMemoryCost()); > #endif >@@ -1006,9 +1006,9 @@ void SourceBuffer::evictCodedFrames(size_t newDataSize) > > // Do not evict data from the time range that contains currentTime. > size_t startTimeRange = buffered.find(rangeStart); >- if (startTimeRange == currentTimeRange) { >+ if (currentTimeRange != notFound && startTimeRange == currentTimeRange) { > size_t endTimeRange = buffered.find(rangeEnd); >- if (endTimeRange == currentTimeRange) >+ if (currentTimeRange != notFound && endTimeRange == currentTimeRange) > break; > > rangeEnd = buffered.start(endTimeRange); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ae1754b93ee288da2c85efe831226f5e1f083b5c..970f69517118c9bfb04d7fc38dccfd472e55a816 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,22 @@ >+2019-06-06 Enrique Ocaña González <eocanha@igalia.com> >+ >+ [MSE][GStreamer] Avoid QUOTA_EXCEEDED_ERR when seeking to a buffered range just before the buffered one >+ https://bugs.webkit.org/show_bug.cgi?id=166620 >+ >+ Reviewed by Xabier Rodriguez-Calvar. >+ >+ Added a test to check that, after the memory is filled by appending a continuous >+ range, a seek right before it and a new append can be done without getting a >+ QuotaExceededError on GStreamer ports. On the rest of the ports, QuotaExceededError >+ is never thrown and the expectations just check that the right buffered ranges >+ remain. >+ >+ * media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt: Added. >+ * media/media-source/media-source-append-before-last-range-no-quota-exceeded.html: Added. >+ * platform/gtk/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt: Added. >+ * platform/wpe/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt: Added. >+ >+ > 2019-06-01 Antoine Quint <graouts@apple.com> > > [Pointer Events] Add support for chorded button interactions >diff --git a/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt b/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a8a617e4e9b99b0fa42500197065fe0d8d3e9026 >--- /dev/null >+++ b/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >@@ -0,0 +1,133 @@ >+ >+EVENT(sourceopen) >+EVENT(updateend) >+EXPECTED (video.currentTime == '120') OK >+Appending PTS=120 >+EVENT(updateend) >+Appending PTS=121 >+EVENT(updateend) >+Appending PTS=122 >+EVENT(updateend) >+Appending PTS=123 >+EVENT(updateend) >+Appending PTS=124 >+EVENT(updateend) >+Appending PTS=125 >+EVENT(updateend) >+Appending PTS=126 >+EVENT(updateend) >+Appending PTS=127 >+EVENT(updateend) >+Appending PTS=128 >+EVENT(updateend) >+Appending PTS=129 >+EVENT(updateend) >+Appending PTS=130 >+EVENT(updateend) >+Appending PTS=131 >+EVENT(updateend) >+Appending PTS=132 >+EVENT(updateend) >+Appending PTS=133 >+EVENT(updateend) >+Appending PTS=134 >+EVENT(updateend) >+Appending PTS=135 >+EVENT(updateend) >+Appending PTS=136 >+EVENT(updateend) >+Appending PTS=137 >+EVENT(updateend) >+Appending PTS=138 >+EVENT(updateend) >+Appending PTS=139 >+EVENT(updateend) >+Appending PTS=140 >+EVENT(updateend) >+Appending PTS=141 >+EVENT(updateend) >+Appending PTS=142 >+EVENT(updateend) >+Appending PTS=143 >+EVENT(updateend) >+Appending PTS=144 >+EVENT(updateend) >+Appending PTS=145 >+EVENT(updateend) >+Appending PTS=146 >+EVENT(updateend) >+Appending PTS=147 >+EVENT(updateend) >+Appending PTS=148 >+EVENT(updateend) >+Appending PTS=149 >+EVENT(updateend) >+Appending PTS=150 >+EVENT(updateend) >+Appending PTS=151 >+EVENT(updateend) >+Appending PTS=152 >+EVENT(updateend) >+Appending PTS=153 >+EVENT(updateend) >+Appending PTS=154 >+EVENT(updateend) >+Appending PTS=155 >+EVENT(updateend) >+Appending PTS=156 >+EVENT(updateend) >+Appending PTS=157 >+EVENT(updateend) >+Appending PTS=158 >+EVENT(updateend) >+Appending PTS=159 >+EVENT(updateend) >+Appending PTS=160 >+EVENT(updateend) >+Appending PTS=161 >+EVENT(updateend) >+Appending PTS=162 >+EVENT(updateend) >+Appending PTS=163 >+EVENT(updateend) >+Appending PTS=164 >+EVENT(updateend) >+Appending PTS=165 >+EVENT(updateend) >+Appending PTS=166 >+EVENT(updateend) >+Appending PTS=167 >+EVENT(updateend) >+Appending PTS=168 >+EVENT(updateend) >+Appending PTS=169 >+EVENT(updateend) >+Appending PTS=170 >+EVENT(updateend) >+Appending PTS=171 >+EVENT(updateend) >+Appending PTS=172 >+EVENT(updateend) >+Appending PTS=173 >+EVENT(updateend) >+Appending PTS=174 >+EVENT(updateend) >+Appending PTS=175 >+EVENT(updateend) >+Appending PTS=176 >+EVENT(updateend) >+EXPECTED (exception == 'QuotaExceededError: The quota has been exceeded.'), OBSERVED 'null' FAIL >+EXPECTED (bufferedRanges() == '[ 120...176 ]'), OBSERVED '[ 120...177 ]' FAIL >+EXPECTED (video.currentTime == '115') OK >+Appending PTS=115 >+EVENT(updateend) >+Appending PTS=116 >+EVENT(updateend) >+Appending PTS=117 >+EVENT(updateend) >+Appending PTS=118 >+EVENT(updateend) >+EXPECTED (exception != 'QuotaExceededError: The quota has been exceeded.') OK >+EXPECTED (bufferedRanges() == '[ 115...119, 120...170 ]') OK >+END OF TEST >+ >diff --git a/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded.html b/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5a0d53294b4b6f43b7a286cc33482ebf7fdfad04 >--- /dev/null >+++ b/LayoutTests/media/media-source/media-source-append-before-last-range-no-quota-exceeded.html >@@ -0,0 +1,88 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>mock-media-source</title> >+ <script src="mock-media-source.js"></script> >+ <script src="../video-test.js"></script> >+ <script> >+ var source; >+ var sourceBuffer; >+ var initSegment; >+ var exception; >+ >+ 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; >+ } >+ >+ async function appendPtsRange(firstPts, lastPts) { >+ var resultException = null; >+ for (var pts = firstPts; pts <= lastPts; pts++) { >+ try { >+ consoleWrite('Appending PTS='+pts); >+ sourceBuffer.appendBuffer(makeASample(pts, pts, 1, 1, 1, SAMPLE_FLAG.SYNC, 1)); >+ await waitFor(sourceBuffer, 'updateend'); >+ } catch (e) { >+ resultException = e; >+ sourceBuffer.abort(); >+ break; >+ } >+ } >+ return resultException; >+ } >+ >+ 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 = URL.createObjectURL(source); >+ 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'); >+ >+ video.currentTime = 120; >+ testExpected('video.currentTime', 120, '=='); >+ >+ // This should allow bufering up to 175 (empirically tested). >+ internals.settings.setMaximumSourceBufferSize(4000); >+ >+ // Append data from 120..176. The SourceBuffer will be filled after 175, so the last iteration should throw QuotaExceededError. >+ exception = await appendPtsRange(120, 176); >+ >+ testExpected('exception', 'QuotaExceededError: The quota has been exceeded.', '=='); >+ testExpected('bufferedRanges()', '[ 120...176 ]', '=='); >+ >+ video.currentTime = 115; >+ testExpected('video.currentTime', 115, '=='); >+ >+ // Now try to append from 115..118. Should free samples from the end and therefore succeed. Should never throw QuotaExceededError. >+ exception = await appendPtsRange(115, 118); >+ >+ testExpected('exception', 'QuotaExceededError: The quota has been exceeded.', '!='); >+ testExpected('bufferedRanges()', '[ 115...119, 120...170 ]', '=='); >+ >+ endTest(); >+ }); >+ </script> >+</head> >+<body> >+ <video></video> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/platform/gtk/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt b/LayoutTests/platform/gtk/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3c68948bdb6cccc7b4373ca9c441fae1b7a2d054 >--- /dev/null >+++ b/LayoutTests/platform/gtk/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >@@ -0,0 +1,132 @@ >+ >+EVENT(sourceopen) >+EVENT(updateend) >+EXPECTED (video.currentTime == '120') OK >+Appending PTS=120 >+EVENT(updateend) >+Appending PTS=121 >+EVENT(updateend) >+Appending PTS=122 >+EVENT(updateend) >+Appending PTS=123 >+EVENT(updateend) >+Appending PTS=124 >+EVENT(updateend) >+Appending PTS=125 >+EVENT(updateend) >+Appending PTS=126 >+EVENT(updateend) >+Appending PTS=127 >+EVENT(updateend) >+Appending PTS=128 >+EVENT(updateend) >+Appending PTS=129 >+EVENT(updateend) >+Appending PTS=130 >+EVENT(updateend) >+Appending PTS=131 >+EVENT(updateend) >+Appending PTS=132 >+EVENT(updateend) >+Appending PTS=133 >+EVENT(updateend) >+Appending PTS=134 >+EVENT(updateend) >+Appending PTS=135 >+EVENT(updateend) >+Appending PTS=136 >+EVENT(updateend) >+Appending PTS=137 >+EVENT(updateend) >+Appending PTS=138 >+EVENT(updateend) >+Appending PTS=139 >+EVENT(updateend) >+Appending PTS=140 >+EVENT(updateend) >+Appending PTS=141 >+EVENT(updateend) >+Appending PTS=142 >+EVENT(updateend) >+Appending PTS=143 >+EVENT(updateend) >+Appending PTS=144 >+EVENT(updateend) >+Appending PTS=145 >+EVENT(updateend) >+Appending PTS=146 >+EVENT(updateend) >+Appending PTS=147 >+EVENT(updateend) >+Appending PTS=148 >+EVENT(updateend) >+Appending PTS=149 >+EVENT(updateend) >+Appending PTS=150 >+EVENT(updateend) >+Appending PTS=151 >+EVENT(updateend) >+Appending PTS=152 >+EVENT(updateend) >+Appending PTS=153 >+EVENT(updateend) >+Appending PTS=154 >+EVENT(updateend) >+Appending PTS=155 >+EVENT(updateend) >+Appending PTS=156 >+EVENT(updateend) >+Appending PTS=157 >+EVENT(updateend) >+Appending PTS=158 >+EVENT(updateend) >+Appending PTS=159 >+EVENT(updateend) >+Appending PTS=160 >+EVENT(updateend) >+Appending PTS=161 >+EVENT(updateend) >+Appending PTS=162 >+EVENT(updateend) >+Appending PTS=163 >+EVENT(updateend) >+Appending PTS=164 >+EVENT(updateend) >+Appending PTS=165 >+EVENT(updateend) >+Appending PTS=166 >+EVENT(updateend) >+Appending PTS=167 >+EVENT(updateend) >+Appending PTS=168 >+EVENT(updateend) >+Appending PTS=169 >+EVENT(updateend) >+Appending PTS=170 >+EVENT(updateend) >+Appending PTS=171 >+EVENT(updateend) >+Appending PTS=172 >+EVENT(updateend) >+Appending PTS=173 >+EVENT(updateend) >+Appending PTS=174 >+EVENT(updateend) >+Appending PTS=175 >+EVENT(updateend) >+Appending PTS=176 >+EXPECTED (exception == 'QuotaExceededError: The quota has been exceeded.') OK >+EXPECTED (bufferedRanges() == '[ 120...176 ]') OK >+EXPECTED (video.currentTime == '115') OK >+Appending PTS=115 >+EVENT(updateend) >+Appending PTS=116 >+EVENT(updateend) >+Appending PTS=117 >+EVENT(updateend) >+Appending PTS=118 >+EVENT(updateend) >+EXPECTED (exception != 'QuotaExceededError: The quota has been exceeded.') OK >+EXPECTED (bufferedRanges() == '[ 115...119, 120...170 ]') OK >+END OF TEST >+ >diff --git a/LayoutTests/platform/wpe/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt b/LayoutTests/platform/wpe/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3c68948bdb6cccc7b4373ca9c441fae1b7a2d054 >--- /dev/null >+++ b/LayoutTests/platform/wpe/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt >@@ -0,0 +1,132 @@ >+ >+EVENT(sourceopen) >+EVENT(updateend) >+EXPECTED (video.currentTime == '120') OK >+Appending PTS=120 >+EVENT(updateend) >+Appending PTS=121 >+EVENT(updateend) >+Appending PTS=122 >+EVENT(updateend) >+Appending PTS=123 >+EVENT(updateend) >+Appending PTS=124 >+EVENT(updateend) >+Appending PTS=125 >+EVENT(updateend) >+Appending PTS=126 >+EVENT(updateend) >+Appending PTS=127 >+EVENT(updateend) >+Appending PTS=128 >+EVENT(updateend) >+Appending PTS=129 >+EVENT(updateend) >+Appending PTS=130 >+EVENT(updateend) >+Appending PTS=131 >+EVENT(updateend) >+Appending PTS=132 >+EVENT(updateend) >+Appending PTS=133 >+EVENT(updateend) >+Appending PTS=134 >+EVENT(updateend) >+Appending PTS=135 >+EVENT(updateend) >+Appending PTS=136 >+EVENT(updateend) >+Appending PTS=137 >+EVENT(updateend) >+Appending PTS=138 >+EVENT(updateend) >+Appending PTS=139 >+EVENT(updateend) >+Appending PTS=140 >+EVENT(updateend) >+Appending PTS=141 >+EVENT(updateend) >+Appending PTS=142 >+EVENT(updateend) >+Appending PTS=143 >+EVENT(updateend) >+Appending PTS=144 >+EVENT(updateend) >+Appending PTS=145 >+EVENT(updateend) >+Appending PTS=146 >+EVENT(updateend) >+Appending PTS=147 >+EVENT(updateend) >+Appending PTS=148 >+EVENT(updateend) >+Appending PTS=149 >+EVENT(updateend) >+Appending PTS=150 >+EVENT(updateend) >+Appending PTS=151 >+EVENT(updateend) >+Appending PTS=152 >+EVENT(updateend) >+Appending PTS=153 >+EVENT(updateend) >+Appending PTS=154 >+EVENT(updateend) >+Appending PTS=155 >+EVENT(updateend) >+Appending PTS=156 >+EVENT(updateend) >+Appending PTS=157 >+EVENT(updateend) >+Appending PTS=158 >+EVENT(updateend) >+Appending PTS=159 >+EVENT(updateend) >+Appending PTS=160 >+EVENT(updateend) >+Appending PTS=161 >+EVENT(updateend) >+Appending PTS=162 >+EVENT(updateend) >+Appending PTS=163 >+EVENT(updateend) >+Appending PTS=164 >+EVENT(updateend) >+Appending PTS=165 >+EVENT(updateend) >+Appending PTS=166 >+EVENT(updateend) >+Appending PTS=167 >+EVENT(updateend) >+Appending PTS=168 >+EVENT(updateend) >+Appending PTS=169 >+EVENT(updateend) >+Appending PTS=170 >+EVENT(updateend) >+Appending PTS=171 >+EVENT(updateend) >+Appending PTS=172 >+EVENT(updateend) >+Appending PTS=173 >+EVENT(updateend) >+Appending PTS=174 >+EVENT(updateend) >+Appending PTS=175 >+EVENT(updateend) >+Appending PTS=176 >+EXPECTED (exception == 'QuotaExceededError: The quota has been exceeded.') OK >+EXPECTED (bufferedRanges() == '[ 120...176 ]') OK >+EXPECTED (video.currentTime == '115') OK >+Appending PTS=115 >+EVENT(updateend) >+Appending PTS=116 >+EVENT(updateend) >+Appending PTS=117 >+EVENT(updateend) >+Appending PTS=118 >+EVENT(updateend) >+EXPECTED (exception != 'QuotaExceededError: The quota has been exceeded.') OK >+EXPECTED (bufferedRanges() == '[ 115...119, 120...170 ]') OK >+END OF TEST >+
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 166620
:
297856
|
371506
| 371579