--- a/testing/web-platform/tests/media-source/mediasource-remove.html
+++ b/testing/web-platform/tests/media-source/mediasource-remove.html
@@ -222,21 +222,22 @@
test.expectEvent(sourceBuffer, "updateend");
sourceBuffer.appendBuffer(mediaData);
test.waitForExpectedEvents(function()
{
mediaSource.endOfStream();
assert_false(sourceBuffer.updating, "updating");
+ var start = Math.max(segmentInfo.media[0].timev, segmentInfo.media[0].timea).toFixed(3);
var duration = mediaElement.duration.toFixed(3);
var subType = MediaSourceUtil.getSubType(segmentInfo.type);
- assertBufferedEquals(sourceBuffer, "{ [0.000, " + duration + ") }", "Initial buffered range.");
- callback(test, mediaSource, sourceBuffer, duration, subType);
+ assertBufferedEquals(sourceBuffer, "{ [" + start + ", " + duration + ") }", "Initial buffered range.");
+ callback(test, mediaSource, sourceBuffer, duration, subType, segmentInfo);
});
}, description);
};
function removeAndCheckBufferedRanges(test, mediaSource, sourceBuffer, start, end, expected)
{
test.expectEvent(sourceBuffer, "updatestart");
test.expectEvent(sourceBuffer, "update");
test.expectEvent(sourceBuffer, "updateend");
@@ -247,50 +248,52 @@
mediaSource.endOfStream();
assert_false(sourceBuffer.updating, "updating");
assertBufferedEquals(sourceBuffer, expected, "Buffered ranges after remove().");
test.done();
});
}
- removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType)
+ removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType, segmentInfo)
{
removeAndCheckBufferedRanges(test, mediaSource, sourceBuffer, 0, Number.POSITIVE_INFINITY, "{ }");
}, "Test removing all appended data.");
- removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType)
+ removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType, segmentInfo)
{
var expectations = {
webm: ("{ [3.187, " + duration + ") }"),
- mp4: ("{ [3.154, " + duration + ") }"),
+ mp4: ("{ [3.187, " + duration + ") }"),
};
// Note: Range doesn't start exactly at the end of the remove range because there isn't
// a keyframe there. The resulting range starts at the first keyframe >= the end time.
removeAndCheckBufferedRanges(test, mediaSource, sourceBuffer, 0, 3, expectations[subType]);
}, "Test removing beginning of appended data.");
- removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType)
+ removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType, segmentInfo)
{
+ var start = Math.max(segmentInfo.media[0].timev, segmentInfo.media[0].timea).toFixed(3);
var expectations = {
- webm: ("{ [0.000, 1.012) [3.187, " + duration + ") }"),
- mp4: ("{ [0.000, 1.022) [3.154, " + duration + ") }"),
+ webm: ("{ [" + start + ", 1.012) [3.187, " + duration + ") }"),
+ mp4: ("{ [" + start + ", 0.996) [3.187, " + duration + ") }"),
};
// Note: The first resulting range ends slightly after start because the removal algorithm only removes
// frames with a timestamp >= the start time. If a frame starts before and ends after the remove() start
// timestamp, then it stays in the buffer.
removeAndCheckBufferedRanges(test, mediaSource, sourceBuffer, 1, 3, expectations[subType]);
}, "Test removing the middle of appended data.");
- removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType)
+ removeAppendedDataTests(function(test, mediaSource, sourceBuffer, duration, subType, segmentInfo)
{
+ var start = Math.max(segmentInfo.media[0].timev, segmentInfo.media[0].timea).toFixed(3);
var expectations = {
- webm: "{ [0.000, 1.012) }",
- mp4: "{ [0.000, 1.029) }",
+ webm: "{ [" + start + ", 1.029) }",
+ mp4: "{ [" + start + ", 1.022) }",
};
removeAndCheckBufferedRanges(test, mediaSource, sourceBuffer, 1, Number.POSITIVE_INFINITY, expectations[subType]);
}, "Test removing the end of appended data.");
</script>
</body>
</html>