-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION (271514@main): MSE Live playback fails on umediaserver.net
https://bugs.webkit.org/show_bug.cgi?id=266385 rdar://119615258 Reviewed by Jer Noble. Changes in 271514@main exposed an underlying existing issue. The MediaSource's duration was initialised to NaN but the GPU process one was initialised to 0. Following 271514@main the inital value would be identical. If the media source duration was set prior any sourcebuffer being created, we wouldn't set the SourceBuffer initial duration, and the step `If the media segment contains data beyond the current duration, then run the duration change algorithm with new duration set to the maximum of the current duration and the [[group end timestamp]].` would always be skipped. We set the initial duration to the sourceBuffer when created. Add tests. * LayoutTests/media/media-source/media-source-append-buffer-durationchange-expected.txt: Added. * LayoutTests/media/media-source/media-source-append-buffer-durationchange.html: Added. * Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer): * Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp: (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer): * Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp: (WebCore::MockMediaSourcePrivate::addSourceBuffer): Canonical link: https://commits.webkit.org/272025@main
- Loading branch information
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
LayoutTests/media/media-source/media-source-append-buffer-durationchange-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
RUN(video.src = URL.createObjectURL(source)) | ||
EVENT(sourceopen) | ||
RUN(source.duration = 0) | ||
RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")) | ||
RUN(sourceBuffer.appendBuffer(initSegment)) | ||
EXPECTED (sourceBuffer.updating == 'true') OK | ||
EVENT(updateend) | ||
EXPECTED (source.duration == '0') OK | ||
EXPECTED (sourceBuffer.updating == 'false') OK | ||
RUN(sourceBuffer.appendBuffer(mediaSegment)) | ||
EVENT(durationchange) | ||
EVENT(updateend) | ||
EXPECTED (source.duration == '16') OK | ||
END OF TEST | ||
|
63 changes: 63 additions & 0 deletions
63
LayoutTests/media/media-source/media-source-append-buffer-durationchange.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!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 mediaSegment; | ||
|
||
if (window.internals) | ||
internals.initializeMockMediaSource(); | ||
|
||
function runTest() { | ||
findMediaElement(); | ||
|
||
source = new MediaSource(); | ||
waitForEventOn(source, 'sourceopen', sourceOpen); | ||
run('video.src = URL.createObjectURL(source)'); | ||
} | ||
|
||
async function sourceOpen() { | ||
run('source.duration = 0'); | ||
run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")'); | ||
|
||
initSegment = makeAInit(100, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]); | ||
run('sourceBuffer.appendBuffer(initSegment)'); | ||
testExpected('sourceBuffer.updating', true); | ||
await Promise.all([ waitForEvent(sourceBuffer, 'update'), waitFor(sourceBuffer, 'updateend') ]); | ||
testExpected('source.duration', 0); | ||
testExpected('sourceBuffer.updating', false); | ||
mediaSegment = concatenateSamples([ | ||
makeASample(0, 0, 1, 1, 1, SAMPLE_FLAG.SYNC, 0) | ||
, makeASample(1, 1, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(2, 2, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(3, 3, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(4, 4, 1, 1, 1, SAMPLE_FLAG.SYNC, 0) | ||
, makeASample(5, 5, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(6, 6, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(7, 7, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(8, 8, 1, 1, 1, SAMPLE_FLAG.SYNC, 0) | ||
, makeASample(9, 9, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(10, 10, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(11, 11, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(12, 12, 1, 1, 1, SAMPLE_FLAG.SYNC, 0) | ||
, makeASample(13, 13, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(14, 14, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
, makeASample(15, 15, 1, 1, 1, SAMPLE_FLAG.NONE, 0) | ||
]); | ||
run('sourceBuffer.appendBuffer(mediaSegment)'); | ||
await Promise.all([ waitForEvent(sourceBuffer, 'update'), waitFor(sourceBuffer, 'updateend'), waitFor(video, 'durationchange') ]); | ||
testExpected('source.duration', 16); | ||
endTest(); | ||
} | ||
|
||
</script> | ||
</head> | ||
<body onload="runTest()"> | ||
<video></video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters