Bug 533822 - Flush liboggz packet_buffer in oggz_reset_streams. r=chris.double

This commit is contained in:
Matthew Gregan 2010-01-08 17:55:39 +13:00
Родитель d194eae91c
Коммит e9e00a2039
8 изменённых файлов: 126 добавлений и 1 удалений

Просмотреть файл

@ -98,6 +98,7 @@ _TEST_FILES = \
test_mozLoadFrom.html \
test_networkState.html \
test_paused.html \
test_play_twice.html \
test_playback.html \
test_playback_errors.html \
test_reactivate.html \
@ -148,6 +149,7 @@ _TEST_FILES += \
bug520908.ogv \
bug520908.ogv^headers^ \
bug523816.ogv \
bug533822.ogg \
chain.ogv \
dirac.ogg \
seek.ogv \

Двоичные данные
content/media/test/bug533822.ogg Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -17,6 +17,12 @@ var gCloneTests = gSmallTests.concat([
{ name:"bug520908.ogv", type:"video/ogg", duration:9000 },
]);
// Used by test_play_twice. Need one test file per decoder backend, plus
// anything for testing bugs that occur when replying a played file.
var gReplayTests = gSmallTests.concat([
{ name:"bug533822.ogg", type:"audio/ogg" },
]);
// These are files that we want to make sure we can play through. We can
// also check metadata. Put files of the same type together in this list so if
// something crashes we have some idea of which backend is responsible.

Просмотреть файл

@ -0,0 +1,93 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test playback of media files that should play OK</title>
<script type="text/javascript" src="/MochiKit/packed.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 PARALLEL_TESTS = 2;
var testIndex = 0;
var videos = [];
var testsWaiting = 0;
function startTests() {
for (var i = 0; i < videos.length; ++i) {
document.body.removeChild(videos[i]);
}
videos = [];
while (videos.length < PARALLEL_TESTS && testIndex < gReplayTests.length) {
var v = document.createElement('video');
var test = gReplayTests[testIndex];
++testIndex;
if (!v.canPlayType(test.type))
continue;
v.src = test.name;
var check = function(test, v) { return function() {
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime);
}
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.readyState != v.NETWORK_LOADED, test.name + " shouldn't report NETWORK_LOADED");
ok(v.ended, test.name + " checking playback has ended");
if (v._playedOnce) {
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
} else {
v._playedOnce = true;
v.play();
}
}}(test, v);
var checkSuspended = function(test, v) { return function() {
if (v.seenSuspend)
return;
v.seenSuspend = true;
ok(true, test.name + " got suspend");
--testsWaiting;
if (testsWaiting == 0) {
setTimeout(startTests, 0);
}
}}(test, v);
v.addEventListener("load", noLoad, false);
v.addEventListener("loadedmetadata", check, false);
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded, false);
v.addEventListener("suspend", checkSuspended, false);
testsWaiting += 2;
document.body.appendChild(v);
v.play();
videos.push(v);
}
if (videos.length == 0) {
// No new tests were spawned, perhaps the remaining tests on the list are
// not supported, or we just reached the end of the list.
SimpleTest.finish();
}
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(startTests);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -35,3 +35,5 @@ bug520493.patch: Fix oggz seek so that it doesn't exit too early, and to use
more accurate page offsets while bisecting.
bug523335.patch: Abort oggz seek bisection when the underlying stream closes.
bug533822.patch: Clear packets queued for granulepos calcuation when resetting streams.

Просмотреть файл

@ -0,0 +1,21 @@
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -135,16 +135,17 @@ oggz_stream_reset (void * data)
}
return 0;
}
static void
oggz_reset_streams (OGGZ * oggz)
{
+ oggz_dlist_deliter(oggz->packet_buffer, oggz_read_free_pbuffers);
oggz_vector_foreach (oggz->streams, oggz_stream_reset);
}
static long
oggz_reset_seek (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence)
{
OggzReader * reader = &oggz->x.reader;

Просмотреть файл

@ -140,6 +140,7 @@ oggz_stream_reset (void * data)
static void
oggz_reset_streams (OGGZ * oggz)
{
oggz_dlist_deliter(oggz->packet_buffer, oggz_read_free_pbuffers);
oggz_vector_foreach (oggz->streams, oggz_stream_reset);
}

Просмотреть файл

@ -63,4 +63,4 @@ patch -p3 <bug519155.patch
patch -p3 <bug498380.patch
patch -p3 <bug520493.patch
patch -p3 <bug523335.patch
patch -p3 <bug533822.patch