Diff
Modified: trunk/LayoutTests/ChangeLog (277344 => 277345)
--- trunk/LayoutTests/ChangeLog 2021-05-12 00:05:49 UTC (rev 277344)
+++ trunk/LayoutTests/ChangeLog 2021-05-12 00:46:17 UTC (rev 277345)
@@ -1,3 +1,13 @@
+2021-05-11 Toshio Ogasawara <[email protected]>
+
+ [MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize.
+ https://bugs.webkit.org/show_bug.cgi?id=225630
+
+ Reviewed by Eric Carlson.
+
+ * media/media-source/media-source-append-buffer-full-quota-exceeded-error-expected.txt: Added.
+ * media/media-source/media-source-append-buffer-full-quota-exceeded-error.html: Added.
+
2021-05-11 Robert Jenner <[email protected]>
[ BigSur wk2 arm64 ] editing/selection/move-by-character-brute-force.html (layout-test) is a flaky timeout
Added: trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error-expected.txt (0 => 277345)
--- trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error-expected.txt 2021-05-12 00:46:17 UTC (rev 277345)
@@ -0,0 +1,34 @@
+
+EVENT(sourceopen)
+EVENT(updateend)
+Appending PTS=0
+EVENT(updateend)
+Appending PTS=1
+EVENT(updateend)
+Appending PTS=2
+EVENT(updateend)
+Appending PTS=3
+EVENT(updateend)
+Appending PTS=4
+EVENT(updateend)
+Appending PTS=5
+EVENT(updateend)
+Appending PTS=6
+EVENT(updateend)
+Appending PTS=7
+EVENT(updateend)
+Appending PTS=8
+EVENT(updateend)
+Appending PTS=9
+EVENT(updateend)
+Appending PTS=10
+EVENT(updateend)
+Appending PTS=11
+EVENT(updateend)
+Appending PTS=12
+EVENT(updateend)
+EXPECTED (exception != 'QuotaExceededError: The quota has been exceeded.') OK
+Appending PTS=13-15
+EXPECTED (exception == 'QuotaExceededError: The quota has been exceeded.') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error.html (0 => 277345)
--- trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-buffer-full-quota-exceeded-error.html 2021-05-12 00:46:17 UTC (rev 277345)
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>mock-media-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+ var exception;
+
+ 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;
+ }
+
+ async function appendConcatenateSamples(start, end) {
+ var resultException = null;
+ const samples = [];
+ for (let time = start; time <= end; time++)
+ samples.push(makeASample(time, time, 1, 1, 1, time === start ? SAMPLE_FLAG.SYNC : SAMPLE_FLAG.NONE));
+
+ try {
+ consoleWrite('Appending PTS='+start+'-'+end );
+ sourceBuffer.appendBuffer(concatenateSamples(samples));
+ await waitFor(sourceBuffer, 'updateend');
+ } catch (e) {
+ resultException = e;
+ sourceBuffer.abort();
+ }
+ 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 = ""
+ 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');
+
+ internals.settings.setMaximumSourceBufferSize(1000);
+
+ exception = await appendPtsRange(0, 12);
+ testExpected('exception', 'QuotaExceededError: The quota has been exceeded.', '!=');
+
+ exception = await appendConcatenateSamples(13, 15);
+ testExpected('exception', 'QuotaExceededError: The quota has been exceeded.', '==');
+
+ endTest();
+ });
+ </script>
+</head>
+<body>
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (277344 => 277345)
--- trunk/Source/WebCore/ChangeLog 2021-05-12 00:05:49 UTC (rev 277344)
+++ trunk/Source/WebCore/ChangeLog 2021-05-12 00:46:17 UTC (rev 277345)
@@ -1,3 +1,18 @@
+2021-05-11 Toshio Ogasawara <[email protected]>
+
+ [MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize.
+ https://bugs.webkit.org/show_bug.cgi?id=225630
+
+ Reviewed by Eric Carlson.
+
+ Test: media/media-source/media-source-append-buffer-full-quota-exceeded-error.html
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::appendBufferInternal):
+ * platform/graphics/SourceBufferPrivate.cpp:
+ (WebCore::SourceBufferPrivate::evictCodedFrames):
+ * platform/graphics/SourceBufferPrivate.h:
+
2021-05-11 Sihui Liu <[email protected]>
Use one VM per thread for IDB serialization work
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (277344 => 277345)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2021-05-12 00:05:49 UTC (rev 277344)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2021-05-12 00:46:17 UTC (rev 277345)
@@ -491,7 +491,7 @@
m_private->evictCodedFrames(size, m_pendingAppendData.capacity(), maximumBufferSize(), m_source->currentTime(), m_source->duration(), m_source->isEnded());
// 5. If the buffer full flag equals true, then throw a QuotaExceededError exception and abort these step.
- if (m_private->bufferFull()) {
+ if (m_private->bufferFull() || m_private->totalTrackBufferSizeInBytes() + m_pendingAppendData.capacity() + size >= maximumBufferSize()) {
ERROR_LOG(LOGIDENTIFIER, "buffer full, failing with QuotaExceededError error");
return Exception { QuotaExceededError };
}
Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (277344 => 277345)
--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-05-12 00:05:49 UTC (rev 277344)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-05-12 00:46:17 UTC (rev 277345)
@@ -639,7 +639,7 @@
// This algorithm is run to free up space in this source buffer when new data is appended.
// 1. Let new data equal the data that is about to be appended to this SourceBuffer.
// 2. If the buffer full flag equals false, then abort these steps.
- if (!m_bufferFull)
+ if (!m_bufferFull && totalTrackBufferSizeInBytes() + pendingAppendDataCapacity + newDataSize < maximumBufferSize)
return;
// 3. Let removal ranges equal a list of presentation time ranges that can be evicted from
Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (277344 => 277345)
--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h 2021-05-12 00:05:49 UTC (rev 277344)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h 2021-05-12 00:46:17 UTC (rev 277345)
@@ -108,6 +108,7 @@
bool hasVideo() const { return m_hasVideo; }
MediaTime timestampOffset() const { return m_timestampOffset; }
+ uint64_t totalTrackBufferSizeInBytes() const;
struct TrackBuffer {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
@@ -168,7 +169,6 @@
WEBCORE_EXPORT void setBufferedRanges(const PlatformTimeRanges&);
void setBufferFull(bool bufferFull) { m_bufferFull = bufferFull; }
void provideMediaData(const AtomString& trackID);
- uint64_t totalTrackBufferSizeInBytes() const;
SourceBufferPrivateClient* m_client { nullptr };