mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 455165 - Tests for ogg chain support. r=cpearce
This commit is contained in:
parent
5311014967
commit
3ba1d1e845
@ -207,6 +207,14 @@ MOCHITEST_FILES += \
|
||||
bug603918.webm \
|
||||
bug604067.webm \
|
||||
chain.ogv \
|
||||
chain.ogg \
|
||||
chain.opus \
|
||||
variable-samplerate.ogg \
|
||||
variable-samplerate.opus \
|
||||
variable-channel.ogg \
|
||||
variable-channel.opus \
|
||||
chained-video.ogv \
|
||||
chained-audio-video.ogg \
|
||||
dirac.ogg \
|
||||
multiple-bos.ogg \
|
||||
split.webm \
|
||||
@ -299,6 +307,7 @@ MOCHITEST_FILES += \
|
||||
contentDuration7.sjs \
|
||||
test_framebuffer.html \
|
||||
test_seekable2.html \
|
||||
test_chaining.html \
|
||||
$(NULL)
|
||||
else
|
||||
MOCHITEST_FILES += \
|
||||
|
BIN
content/media/test/chain.ogg
Normal file
BIN
content/media/test/chain.ogg
Normal file
Binary file not shown.
BIN
content/media/test/chain.opus
Normal file
BIN
content/media/test/chain.opus
Normal file
Binary file not shown.
BIN
content/media/test/chained-audio-video.ogg
Normal file
BIN
content/media/test/chained-audio-video.ogg
Normal file
Binary file not shown.
BIN
content/media/test/chained-video.ogv
Normal file
BIN
content/media/test/chained-video.ogv
Normal file
Binary file not shown.
@ -331,6 +331,32 @@ var gFragmentTests = [
|
||||
{ name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 }
|
||||
];
|
||||
|
||||
// Used by test_chaining.html. The |links| attributes is the number of links in
|
||||
// this file that we should be able to play.
|
||||
var gChainingTests = [
|
||||
// Vorbis and Opus chained file. They have user comments |index=n| where `n`
|
||||
// is the index of this segment in the file, 0 indexed.
|
||||
{ name:"chain.ogg", type:"audio/ogg", links: 4},
|
||||
{ name:"chain.opus", type:"audio/ogg; codec=opus", links: 4},
|
||||
// Those files are chained files with a different number of channels in each
|
||||
// part. This is not supported and should stop playing after the first part.
|
||||
{ name:"variable-channel.ogg", type:"audio/ogg", links: 1 },
|
||||
{ name:"variable-channel.opus", type:"audio/ogg; codec=opus", links: 1 },
|
||||
// Those files are chained files with a different sample rate in each
|
||||
// part. This is not supported and should stop playing after the first part.
|
||||
{ name:"variable-samplerate.ogg", type:"audio/ogg", links: 1 },
|
||||
// Opus decoding in Firefox outputs 48 kHz PCM despite having a different
|
||||
// original sample rate, so we can safely play Opus chained media that have
|
||||
// different samplerate accross links.
|
||||
{ name:"variable-samplerate.opus", type:"audio/ogg; codec=opus", links: 2 },
|
||||
// A chained video file. We don't support those, so only one link should be
|
||||
// reported.
|
||||
{ name:"chained-video.ogv", type:"video/ogg", links: 1 },
|
||||
// A file that consist in 4 links of audio, then another link that has video.
|
||||
// We should stop right after the 4 audio links.
|
||||
{ name:"chained-audio-video.ogg", type:"video/ogg", links: 4 },
|
||||
{ name:"bogus.duh", type:"bogus/duh" }
|
||||
];
|
||||
|
||||
// These are files with non-trivial tag sets.
|
||||
// Used by test_metadata.html.
|
||||
|
91
content/media/test/test_chaining.html
Normal file
91
content/media/test/test_chaining.html
Normal file
@ -0,0 +1,91 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media test: chained ogg files.</title>
|
||||
<meta charset='utf-8'>
|
||||
<script type="text/javascript" src="/MochiKit/Base.js"></script>
|
||||
<script type="text/javascript" src="/MochiKit/DOM.js"></script>
|
||||
<script type="text/javascript" src="/MochiKit/Style.js"></script>
|
||||
<script type="text/javascript" src="/MochiKit/Signal.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
function finish_test(element) {
|
||||
if (element.parentNode)
|
||||
element.parentNode.removeChild(element);
|
||||
manager.finished(element.token);
|
||||
}
|
||||
|
||||
function onended(e) {
|
||||
var t = e.target;
|
||||
is(t._metadataCount, t._links, "We should have received "+ t._links +
|
||||
" metadataloaded event. " + t.src);
|
||||
|
||||
// If we encounter a file that has links with a different numbers of channel,
|
||||
// we stop the decoding at the end of the first link. Hence, we report normal
|
||||
// |seekable| and |buffered| values.
|
||||
if (t._links != 1) {
|
||||
is(t.seekable.length, 0, "No seekable ranges should be reported." + t.src);
|
||||
is(t.buffered.length, 0, "No buffered region should be reported." + t.src);
|
||||
}
|
||||
|
||||
is(t.played.length, 1, "The played region should be continuous." + t.src);
|
||||
|
||||
if (t._links != 1) {
|
||||
var oldCurrentTime = t.currentTime;
|
||||
t.currentTime = 0.0;
|
||||
is(t.currentTime, oldCurrentTime,
|
||||
"Seeking should be disabled when playing chained media." + t.src);
|
||||
}
|
||||
|
||||
finish_test(t);
|
||||
}
|
||||
|
||||
function onmetadataloaded(e) {
|
||||
var t = e.target;
|
||||
if (! t._metadataCount) {
|
||||
t._metadataCount = 0;
|
||||
}
|
||||
|
||||
if (t._metadataCount > 1 && t._links === 1) {
|
||||
ok(false, "We should receive only one \"loadedmetadata\" event for a chained file we don't support.")
|
||||
}
|
||||
|
||||
// We should be able to assert equality here, but somehow it fails (rarely but
|
||||
// still) on try. Instead, we give it a little slack and assert that the index
|
||||
// increases monotonically.
|
||||
ok(t.mozGetMetadata().index >= t._metadataCount || t._links === 1,
|
||||
"The metadata index value should increase." + t.src);
|
||||
|
||||
// The files have all a user comment name 'index' that increments at each link
|
||||
// in the chained media.
|
||||
t._metadataCount++;
|
||||
if (!t.playing && !t.ended) {
|
||||
t.play();
|
||||
}
|
||||
}
|
||||
|
||||
function startTest(test, token) {
|
||||
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
||||
var element = document.createElement(elemType);
|
||||
document.body.appendChild(element);
|
||||
manager.started(token);
|
||||
element._links= test.links;
|
||||
element.src = test.name;
|
||||
element.token = token;
|
||||
element.controls = true;
|
||||
element.addEventListener("loadedmetadata", onmetadataloaded);
|
||||
element.addEventListener("ended", onended);
|
||||
}
|
||||
|
||||
manager.runTests(gChainingTests, startTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
BIN
content/media/test/variable-channel.ogg
Normal file
BIN
content/media/test/variable-channel.ogg
Normal file
Binary file not shown.
BIN
content/media/test/variable-channel.opus
Normal file
BIN
content/media/test/variable-channel.opus
Normal file
Binary file not shown.
BIN
content/media/test/variable-samplerate.ogg
Normal file
BIN
content/media/test/variable-samplerate.ogg
Normal file
Binary file not shown.
BIN
content/media/test/variable-samplerate.opus
Normal file
BIN
content/media/test/variable-samplerate.opus
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user