Diff
Modified: trunk/LayoutTests/ChangeLog (276413 => 276414)
--- trunk/LayoutTests/ChangeLog 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/ChangeLog 2021-04-22 01:28:38 UTC (rev 276414)
@@ -1,3 +1,24 @@
+2021-04-21 Peng Liu <[email protected]>
+
+ [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes
+ https://bugs.webkit.org/show_bug.cgi?id=224891
+
+ Reviewed by Eric Carlson.
+
+ Update following tests to use the asynchronous `enqueuedSamplesForTrackID()`.
+ * media/media-source/media-source-append-acb-no-frame-lost.html:
+ * media/media-source/media-source-append-acb-tolerance.html:
+ * media/media-source/media-source-append-presentation-durations.html:
+ * media/media-source/media-source-dropped-iframe.html:
+ * media/media-source/media-source-erase-after-last-append.html:
+ * media/media-source/media-source-first-append-not-starting-at-zero.html:
+ * media/media-source/media-source-remove-b-frame.html:
+ * media/media-source/media-source-seek-back.html:
+ * media/media-source/media-source-timestampoffset-rounding-error.html:
+
+ We don't need this platform-specific test expectation now.
+ * platform/mac/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt: Removed.
+
2021-04-21 Amir Mark Jr <[email protected]>
Mass removal of prior test expectations that do not need to be set anymore.
Modified: trunk/LayoutTests/media/media-source/media-source-append-acb-no-frame-lost.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-append-acb-no-frame-lost.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-append-acb-no-frame-lost.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -53,7 +53,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
// 30 samples were appended in total. All of them should have ended up in buffered samples and in the decode queue.
testExpected('bufferedSamples.length', 30);
Modified: trunk/LayoutTests/media/media-source/media-source-append-acb-tolerance.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-append-acb-tolerance.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-append-acb-tolerance.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -65,7 +65,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
// 30 samples were appended in total. All of them should have ended up in buffered samples and in the decode queue.
testExpected('bufferedSamples.length', 15 * 30);
Modified: trunk/LayoutTests/media/media-source/media-source-append-presentation-durations.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-append-presentation-durations.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-append-presentation-durations.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -50,10 +50,11 @@
await waitFor(sourceBuffer, 'updateend');
consoleWrite("Buffered:");
- bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
+ const bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
bufferedSamples.forEach(consoleWrite);
consoleWrite("Enqueued:");
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ const enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
endTest();
});
Modified: trunk/LayoutTests/media/media-source/media-source-dropped-iframe.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-dropped-iframe.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-dropped-iframe.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -45,7 +45,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
consoleWrite("Buffered:");
bufferedSamples.forEach(consoleWrite);
Modified: trunk/LayoutTests/media/media-source/media-source-erase-after-last-append.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-erase-after-last-append.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-erase-after-last-append.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -47,7 +47,8 @@
run('source.endOfStream()');
// Samples with PTS >= 5 should have been deleted and not reach playback.
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ const enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
endTest();
});
</script>
Modified: trunk/LayoutTests/media/media-source/media-source-first-append-not-starting-at-zero.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-first-append-not-starting-at-zero.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-first-append-not-starting-at-zero.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -42,13 +42,15 @@
await waitFor(sourceBuffer, 'updateend');
consoleWrite("Enqueued so far: (expecting no frames yet)");
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ let enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
run('sourceBuffer.appendBuffer(syncSampleRun(0, 5))');
await waitFor(sourceBuffer, 'updateend');
consoleWrite("Enqueued now:");
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
endTest();
});
Modified: trunk/LayoutTests/media/media-source/media-source-remove-b-frame.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-remove-b-frame.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-remove-b-frame.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -42,7 +42,8 @@
run('sourceBuffer.appendBuffer(ibpSampleRun())');
await waitFor(sourceBuffer, 'updateend');
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ let enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
run('sourceBuffer.remove(1, 2)');
await waitFor(sourceBuffer, 'updateend');
@@ -58,7 +59,8 @@
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
bufferedSamples.forEach(consoleWrite);
consoleWrite("Enqueued:");
- internals.enqueuedSamplesForTrackID(sourceBuffer, 1).forEach(consoleWrite);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples.forEach(consoleWrite);
endTest();
});
Modified: trunk/LayoutTests/media/media-source/media-source-seek-back.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-seek-back.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-seek-back.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -59,9 +59,9 @@
run('sourceBuffer.appendBuffer(samples)');
}
- function seeked()
+ async function seeked()
{
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
testExpected("enqueuedSamples.length", 1);
enqueuedSamples.forEach(consoleWrite);
endTest();
Modified: trunk/LayoutTests/media/media-source/media-source-timestampoffset-rounding-error.html (276413 => 276414)
--- trunk/LayoutTests/media/media-source/media-source-timestampoffset-rounding-error.html 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/media/media-source/media-source-timestampoffset-rounding-error.html 2021-04-22 01:28:38 UTC (rev 276414)
@@ -42,7 +42,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
run("sourceBuffer.timestampOffset = 1");
run('sourceBuffer.appendBuffer(makeVideo(1, 6))');
@@ -49,7 +49,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
run("sourceBuffer.timestampOffset = 1.5");
run('sourceBuffer.appendBuffer(makeVideo(2, 5))');
@@ -56,7 +56,7 @@
await waitFor(sourceBuffer, 'updateend');
bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1);
- enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+ enqueuedSamples = await internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
consoleWrite("Buffered:");
bufferedSamples.forEach(consoleWrite);
Deleted: trunk/LayoutTests/platform/mac/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt (276413 => 276414)
--- trunk/LayoutTests/platform/mac/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/LayoutTests/platform/mac/media/media-source/media-source-append-before-last-range-no-quota-exceeded-expected.txt 2021-04-22 01:28:38 UTC (rev 276414)
@@ -1,132 +0,0 @@
-
-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
-
Modified: trunk/Source/WebCore/ChangeLog (276413 => 276414)
--- trunk/Source/WebCore/ChangeLog 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/ChangeLog 2021-04-22 01:28:38 UTC (rev 276414)
@@ -1,3 +1,39 @@
+2021-04-21 Peng Liu <[email protected]>
+
+ [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes
+ https://bugs.webkit.org/show_bug.cgi?id=224891
+
+ Reviewed by Eric Carlson.
+
+ This patch is a preparation to run `MockMediaPlayerMediaSource` in the GPU Process.
+
+ `SourceBuffer::enqueuedSamplesForTrackID()` is a synchronous function used for testing
+ purposes. It works fine when "Media in GPU process" is disabled. However, when
+ "Media in GPU process" is enabled, we have to use a synchronous IPC message to
+ implement it. This patch changes it to be a function with a completion handler
+ parameter, so that we can implement it with an asynchronous IPC message when
+ we run `MockMediaPlayerMediaSource` in the GPU process.
+
+ There is no behavior change when "Media in GPU Process" is disabled.
+
+ Covered by existing tests.
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::enqueuedSamplesForTrackID):
+ * Modules/mediasource/SourceBuffer.h:
+ * platform/graphics/SourceBufferPrivate.cpp:
+ (WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):
+ * platform/graphics/SourceBufferPrivate.h:
+ (WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID): Deleted.
+ * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
+ (WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID):
+ * platform/mock/mediasource/MockSourceBufferPrivate.h:
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::enqueuedSamplesForTrackID):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2021-04-21 Chris Dumez <[email protected]>
Crash under RegistrationDatabase::openSQLiteDatabase()
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (276413 => 276414)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -1215,9 +1215,9 @@
m_private->bufferedSamplesForTrackId(trackID, WTFMove(completionHandler));
}
-Vector<String> SourceBuffer::enqueuedSamplesForTrackID(const AtomString& trackID)
+void SourceBuffer::enqueuedSamplesForTrackID(const AtomString& trackID, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
{
- return m_private->enqueuedSamplesForTrackID(trackID);
+ return m_private->enqueuedSamplesForTrackID(trackID, WTFMove(completionHandler));
}
MediaTime SourceBuffer::minimumUpcomingPresentationTimeForTrackID(const AtomString& trackID)
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (276413 => 276414)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -202,7 +202,7 @@
friend class Internals;
WEBCORE_EXPORT void bufferedSamplesForTrackId(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&);
- WEBCORE_EXPORT Vector<String> enqueuedSamplesForTrackID(const AtomString&);
+ WEBCORE_EXPORT void enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&);
WEBCORE_EXPORT MediaTime minimumUpcomingPresentationTimeForTrackID(const AtomString&);
WEBCORE_EXPORT void setMaximumQueueDepthForTrackID(const AtomString&, uint64_t);
Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (276413 => 276414)
--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -218,6 +218,11 @@
completionHandler(WTFMove(sampleDescriptions));
}
+void SourceBufferPrivate::enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
+{
+ completionHandler({ });
+}
+
MediaTime SourceBufferPrivate::fastSeekTimeForMediaTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold)
{
if (!m_client)
Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (276413 => 276414)
--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -135,7 +135,7 @@
// Internals Utility methods
WEBCORE_EXPORT virtual void bufferedSamplesForTrackId(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&);
- virtual Vector<String> enqueuedSamplesForTrackID(const AtomString&) { return { }; }
+ WEBCORE_EXPORT virtual void enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&);
virtual MediaTime minimumUpcomingPresentationTimeForTrackID(const AtomString&) { return MediaTime::invalidTime(); }
virtual void setMaximumQueueDepthForTrackID(const AtomString&, uint64_t) { }
WEBCORE_EXPORT MediaTime fastSeekTimeForMediaTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold);
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp (276413 => 276414)
--- trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -244,9 +244,9 @@
return m_isActive;
}
-Vector<String> MockSourceBufferPrivate::enqueuedSamplesForTrackID(const AtomString&)
+void MockSourceBufferPrivate::enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
{
- return m_enqueuedSamples;
+ completionHandler(copyToVector(m_enqueuedSamples));
}
MediaTime MockSourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID(const AtomString&)
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h (276413 => 276414)
--- trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -70,7 +70,7 @@
void setActive(bool) final;
bool isActive() const final;
- Vector<String> enqueuedSamplesForTrackID(const AtomString&) final;
+ void enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&) final;
MediaTime minimumUpcomingPresentationTimeForTrackID(const AtomString&) final;
void setMaximumQueueDepthForTrackID(const AtomString&, uint64_t) final;
Modified: trunk/Source/WebCore/testing/Internals.cpp (276413 => 276414)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -4140,9 +4140,11 @@
});
}
-Vector<String> Internals::enqueuedSamplesForTrackID(SourceBuffer& buffer, const AtomString& trackID)
+void Internals::enqueuedSamplesForTrackID(SourceBuffer& buffer, const AtomString& trackID, BufferedSamplesPromise&& promise)
{
- return buffer.enqueuedSamplesForTrackID(trackID);
+ return buffer.enqueuedSamplesForTrackID(trackID, [promise = WTFMove(promise)](auto&& samples) mutable {
+ promise.resolve(WTFMove(samples));
+ });
}
double Internals::minimumUpcomingPresentationTimeForTrackID(SourceBuffer& buffer, const AtomString& trackID)
Modified: trunk/Source/WebCore/testing/Internals.h (276413 => 276414)
--- trunk/Source/WebCore/testing/Internals.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/testing/Internals.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -683,7 +683,7 @@
WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
using BufferedSamplesPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>;
void bufferedSamplesForTrackId(SourceBuffer&, const AtomString&, BufferedSamplesPromise&&);
- Vector<String> enqueuedSamplesForTrackID(SourceBuffer&, const AtomString&);
+ void enqueuedSamplesForTrackID(SourceBuffer&, const AtomString&, BufferedSamplesPromise&&);
double minimumUpcomingPresentationTimeForTrackID(SourceBuffer&, const AtomString&);
void setShouldGenerateTimestamps(SourceBuffer&, bool);
void setMaximumQueueDepthForTrackID(SourceBuffer&, const AtomString&, size_t);
Modified: trunk/Source/WebCore/testing/Internals.idl (276413 => 276414)
--- trunk/Source/WebCore/testing/Internals.idl 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebCore/testing/Internals.idl 2021-04-22 01:28:38 UTC (rev 276414)
@@ -715,7 +715,7 @@
[Conditional=MEDIA_SOURCE] undefined initializeMockMediaSource();
[Conditional=MEDIA_SOURCE] Promise<sequence<DOMString>> bufferedSamplesForTrackId(SourceBuffer buffer, DOMString trackId);
- [Conditional=MEDIA_SOURCE] sequence<DOMString> enqueuedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
+ [Conditional=MEDIA_SOURCE] Promise<sequence<DOMString>> enqueuedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
[Conditional=MEDIA_SOURCE] undefined setShouldGenerateTimestamps(SourceBuffer buffer, boolean flag);
[Conditional=MEDIA_SOURCE] double minimumUpcomingPresentationTimeForTrackID(SourceBuffer buffer, DOMString trackID);
[Conditional=MEDIA_SOURCE] undefined setMaximumQueueDepthForTrackID(SourceBuffer buffer, DOMString trackID, unsigned long maxQueueDepth);
Modified: trunk/Source/WebKit/ChangeLog (276413 => 276414)
--- trunk/Source/WebKit/ChangeLog 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/ChangeLog 2021-04-22 01:28:38 UTC (rev 276414)
@@ -1,3 +1,19 @@
+2021-04-21 Peng Liu <[email protected]>
+
+ [GPUP] Refactor SourceBuffer::enqueuedSamplesForTrackID() for testing purposes
+ https://bugs.webkit.org/show_bug.cgi?id=224891
+
+ Reviewed by Eric Carlson.
+
+ * GPUProcess/media/RemoteSourceBufferProxy.cpp:
+ (WebKit::RemoteSourceBufferProxy::enqueuedSamplesForTrackID):
+ * GPUProcess/media/RemoteSourceBufferProxy.h:
+ * GPUProcess/media/RemoteSourceBufferProxy.messages.in:
+ * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
+ (WebKit::SourceBufferPrivateRemote::bufferedSamplesForTrackId):
+ (WebKit::SourceBufferPrivateRemote::enqueuedSamplesForTrackID):
+ * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
+
2021-04-21 John Wilander <[email protected]>
PCM: Remove PrivateClickMeasurement::PcmDataCarried::NonPersonallyIdentifiable overrides in testing
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp (276413 => 276414)
--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -353,6 +353,13 @@
m_sourceBufferPrivate->bufferedSamplesForTrackId(m_trackIds.get(trackPrivateRemoteIdentifier), WTFMove(completionHandler));
}
+void RemoteSourceBufferProxy::enqueuedSamplesForTrackID(TrackPrivateRemoteIdentifier trackPrivateRemoteIdentifier, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
+{
+ ASSERT(m_trackIds.contains(trackPrivateRemoteIdentifier));
+ ASSERT(m_mediaDescriptions.contains(trackPrivateRemoteIdentifier));
+ m_sourceBufferPrivate->bufferedSamplesForTrackId(m_trackIds.get(trackPrivateRemoteIdentifier), WTFMove(completionHandler));
+}
+
} // namespace WebKit
#endif // ENABLE(GPU_PROCESS) && ENABLE(MEDIA_SOURCE)
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h (276413 => 276414)
--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -111,6 +111,7 @@
void seekToTime(const MediaTime&);
void updateTrackIds(Vector<std::pair<TrackPrivateRemoteIdentifier, TrackPrivateRemoteIdentifier>>&&);
void bufferedSamplesForTrackId(TrackPrivateRemoteIdentifier, CompletionHandler<void(Vector<String>&&)>&&);
+ void enqueuedSamplesForTrackID(TrackPrivateRemoteIdentifier, CompletionHandler<void(Vector<String>&&)>&&);
WeakPtr<GPUConnectionToWebProcess> m_connectionToWebProcess;
RemoteSourceBufferIdentifier m_identifier;
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in (276413 => 276414)
--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in 2021-04-22 01:28:38 UTC (rev 276414)
@@ -54,6 +54,7 @@
SeekToTime(MediaTime mediaTime)
UpdateTrackIds(Vector<std::pair<WebKit::TrackPrivateRemoteIdentifier, WebKit::TrackPrivateRemoteIdentifier>> identifierPairs)
BufferedSamplesForTrackId(WebKit::TrackPrivateRemoteIdentifier remoteIdentifier) -> (Vector<String> samples) Async
+ EnqueuedSamplesForTrackID(WebKit::TrackPrivateRemoteIdentifier remoteIdentifier) -> (Vector<String> samples) Async
}
#endif
Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp (276413 => 276414)
--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp 2021-04-22 01:28:38 UTC (rev 276414)
@@ -345,6 +345,16 @@
}, m_remoteSourceBufferIdentifier);
}
+void SourceBufferPrivateRemote::enqueuedSamplesForTrackID(const AtomString& trackId, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
+{
+ if (!m_gpuProcessConnection)
+ return;
+
+ m_gpuProcessConnection->connection().sendWithAsyncReply(Messages::RemoteSourceBufferProxy::EnqueuedSamplesForTrackID(m_trackIdentifierMap.get(trackId)), [completionHandler = WTFMove(completionHandler)](auto&& samples) mutable {
+ completionHandler(WTFMove(samples));
+ }, m_remoteSourceBufferIdentifier);
+}
+
void SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegmentInfo&& segmentInfo, CompletionHandler<void()>&& completionHandler)
{
if (!m_client || !m_mediaPlayerPrivate) {
Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h (276413 => 276414)
--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h 2021-04-22 01:15:13 UTC (rev 276413)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h 2021-04-22 01:28:38 UTC (rev 276414)
@@ -104,6 +104,7 @@
// Internals Utility methods
void bufferedSamplesForTrackId(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&) final;
+ void enqueuedSamplesForTrackID(const AtomString&, CompletionHandler<void(Vector<String>&&)>&&) final;
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
void sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegmentInfo&&, CompletionHandler<void()>&&);