Diff
Modified: trunk/LayoutTests/ChangeLog (238053 => 238054)
--- trunk/LayoutTests/ChangeLog 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/LayoutTests/ChangeLog 2018-11-09 21:59:22 UTC (rev 238054)
@@ -1,3 +1,13 @@
+2018-11-09 Jer Noble <jer.no...@apple.com>
+
+ SourceBuffer throws an error when appending a second init segment after changeType().
+ https://bugs.webkit.org/show_bug.cgi?id=191474
+
+ Reviewed by Eric Carlson.
+
+ * media/media-source/media-source-changetype-second-init-expected.txt: Added.
+ * media/media-source/media-source-changetype-second-init.html: Added.
+
2018-11-09 Andy Estes <aes...@apple.com>
[Payment Request] canMakePayment() should not consider serialized payment method data
Added: trunk/LayoutTests/media/media-source/media-source-changetype-second-init-expected.txt (0 => 238054)
--- trunk/LayoutTests/media/media-source/media-source-changetype-second-init-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-changetype-second-init-expected.txt 2018-11-09 21:59:22 UTC (rev 238054)
@@ -0,0 +1,13 @@
+
+EXPECTED (source.readyState == 'closed') OK
+EVENT(sourceopen)
+RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock"))
+RUN(sourceBuffer.appendBuffer(initSegment))
+EVENT(updateend)
+RUN(sourceBuffer.changeType("video/mock; codecs=kcom"))
+RUN(sourceBuffer.appendBuffer(initSegment2))
+EVENT(updateend)
+RUN(sourceBuffer.appendBuffer(initSegment2))
+EVENT(updateend)
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-changetype-second-init.html (0 => 238054)
--- trunk/LayoutTests/media/media-source/media-source-changetype-second-init.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-changetype-second-init.html 2018-11-09 21:59:22 UTC (rev 238054)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>mock-media-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+ var initSegment2;
+ var samples;
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ async function runTest() {
+ findMediaElement();
+
+ source = new MediaSource();
+ testExpected('source.readyState', 'closed');
+
+ video.srcObject = source;
+ await waitFor(source, 'sourceopen');
+
+ run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
+ initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ run('sourceBuffer.appendBuffer(initSegment)');
+ await waitFor(sourceBuffer, 'updateend');
+
+ run('sourceBuffer.changeType("video/mock; codecs=kcom")');
+
+ initSegment2 = makeAInit(8, [makeATrack(1, 'kcom', TRACK_KIND.VIDEO)]);
+ run('sourceBuffer.appendBuffer(initSegment2)');
+ await waitFor(sourceBuffer, 'updateend');
+
+ run('sourceBuffer.appendBuffer(initSegment2)');
+ await waitFor(sourceBuffer, 'updateend');
+
+ endTest()
+ }
+
+ </script>
+</head>
+<body _onload_="runTest().catch(failTest)">
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (238053 => 238054)
--- trunk/Source/WebCore/ChangeLog 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/Source/WebCore/ChangeLog 2018-11-09 21:59:22 UTC (rev 238054)
@@ -1,3 +1,23 @@
+2018-11-09 Jer Noble <jer.no...@apple.com>
+
+ SourceBuffer throws an error when appending a second init segment after changeType().
+ https://bugs.webkit.org/show_bug.cgi?id=191474
+
+ Reviewed by Eric Carlson.
+
+ Test: media/media-source/media-source-changetype-second-init.html
+
+ When encountering an initialization segment after changeType(), add the parsed codec types
+ to the list of allowed codecs.
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::validateInitializationSegment):
+ * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
+ (WebCore::MockMediaPlayerMediaSource::supportsType):
+ * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
+ (WebCore::MockSourceBufferPrivate::canSwitchToType):
+ * platform/mock/mediasource/MockSourceBufferPrivate.h:
+
2018-11-09 Eric Carlson <eric.carl...@apple.com>
[MediaStream] AVVideoCaptureSource reports incorrect size when frames are scaled
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (238053 => 238054)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2018-11-09 21:59:22 UTC (rev 238054)
@@ -1309,23 +1309,36 @@
// (Note: Issue #155 strikes out this check. For broad compatibility when this experimental feature
// is not enabled, only perform this check if the "pending initialization segment for changeType flag"
// is not set.)
- if (!m_pendingInitializationSegmentForChangeType) {
- for (auto& audioTrackInfo : segment.audioTracks) {
- if (!m_audioCodecs.contains(audioTrackInfo.description->codec()))
- return false;
- }
+ for (auto& audioTrackInfo : segment.audioTracks) {
+ if (m_audioCodecs.contains(audioTrackInfo.description->codec()))
+ continue;
- for (auto& videoTrackInfo : segment.videoTracks) {
- if (!m_videoCodecs.contains(videoTrackInfo.description->codec()))
- return false;
- }
+ if (!m_pendingInitializationSegmentForChangeType)
+ return false;
- for (auto& textTrackInfo : segment.textTracks) {
- if (!m_textCodecs.contains(textTrackInfo.description->codec()))
- return false;
- }
+ m_audioCodecs.append(audioTrackInfo.description->codec());
}
+ for (auto& videoTrackInfo : segment.videoTracks) {
+ if (m_videoCodecs.contains(videoTrackInfo.description->codec()))
+ continue;
+
+ if (!m_pendingInitializationSegmentForChangeType)
+ return false;
+
+ m_videoCodecs.append(videoTrackInfo.description->codec());
+ }
+
+ for (auto& textTrackInfo : segment.textTracks) {
+ if (m_textCodecs.contains(textTrackInfo.description->codec()))
+ continue;
+
+ if (!m_pendingInitializationSegmentForChangeType)
+ return false;
+
+ m_textCodecs.append(textTrackInfo.description->codec());
+ }
+
// * If more than one track for a single type are present (ie 2 audio tracks), then the Track
// IDs match the ones in the first initialization segment.
if (segment.audioTracks.size() >= 2) {
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (238053 => 238054)
--- trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2018-11-09 21:59:22 UTC (rev 238054)
@@ -72,7 +72,10 @@
if (codecs.isEmpty())
return MediaPlayer::MayBeSupported;
- return codecs == "mock" ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
+ if (codecs == "mock" || codecs == "kcom")
+ return MediaPlayer::IsSupported;
+
+ return MediaPlayer::MayBeSupported;
}
MockMediaPlayerMediaSource::MockMediaPlayerMediaSource(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp (238053 => 238054)
--- trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp 2018-11-09 21:59:22 UTC (rev 238054)
@@ -240,6 +240,14 @@
return m_enqueuedSamples;
}
+bool MockSourceBufferPrivate::canSwitchToType(const ContentType& contentType)
+{
+ MediaEngineSupportParameters parameters;
+ parameters.isMediaSource = true;
+ parameters.type = contentType;
+ return MockMediaPlayerMediaSource::supportsType(parameters) != MediaPlayer::IsNotSupported;
+}
+
void MockSourceBufferPrivate::enqueueSample(Ref<MediaSample>&& sample, const AtomicString&)
{
if (!m_mediaSource)
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h (238053 => 238054)
--- trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h 2018-11-09 21:26:16 UTC (rev 238053)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h 2018-11-09 21:59:22 UTC (rev 238054)
@@ -63,6 +63,7 @@
void removedFromMediaSource() final;
MediaPlayer::ReadyState readyState() const final;
void setReadyState(MediaPlayer::ReadyState) final;
+ bool canSwitchToType(const ContentType&) final;
void flush(const AtomicString&) final { m_enqueuedSamples.clear(); }
void enqueueSample(Ref<MediaSample>&&, const AtomicString&) final;