Bug 496063. Avoid infinite loops on shutdown or error while seeking. r=cpearce

This commit is contained in:
Chris Double 2009-06-04 14:06:03 +12:00
Родитель 86fa0e0fb3
Коммит 11ed802b51
4 изменённых файлов: 48 добавлений и 0 удалений

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

@ -18,3 +18,4 @@ key_frame_seek.patch fixes bug 463358.
offset_next.patch fixes bug 495366.
bug487519.patch: Fix for bug 487519.
bug496063.patch: Fix for infinite loop during seek while shutting down.

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

@ -0,0 +1,42 @@
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
index fff5158..f457244 100644
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -476,16 +476,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
serialno = ogg_page_serialno (og);
granule_at = ogg_page_granulepos (og);
unit_at = oggz_get_unit (oggz, serialno, granule_at);
break;
#else
do {
offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
+ if (offset_at < 0)
+ break;
unit_at = oggz_get_unit(oggz, serialno, granule_at);
} while (unit_at > unit_target);
return offset_at;
#endif
} else if (unit_at == unit_target) {
#ifdef DEBUG
printf (" scan: (%lld) == (%lld)\n", unit_at, unit_target);
#endif
@@ -765,16 +767,18 @@ oggz_bounded_seek_set (OGGZ * oggz,
if (unit_end == unit_begin) break;
} else {
break;
}
}
do {
offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
+ if (offset_at < 0)
+ break;
unit_at = oggz_get_unit (oggz, serialno, granule_at);
} while (unit_at > unit_target);
if (offset_at < 0) {
oggz_reset (oggz, offset_orig, -1, SEEK_SET);
return -1;
}

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

@ -481,6 +481,8 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
#else
do {
offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
if (offset_at < 0)
break;
unit_at = oggz_get_unit(oggz, serialno, granule_at);
} while (unit_at > unit_target);
return offset_at;
@ -770,6 +772,8 @@ oggz_bounded_seek_set (OGGZ * oggz,
do {
offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
if (offset_at < 0)
break;
unit_at = oggz_get_unit (oggz, serialno, granule_at);
} while (unit_at > unit_target);

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

@ -50,3 +50,4 @@ patch -p3 <bounded_seek.patch
patch -p3 <key_frame_seek.patch
patch -p3 <offset_next.patch
patch -p3 <bug487519.patch
patch -p3 <bug496063.patch