Commit c92285b5 authored by conrad's avatar conrad

improve looping detection (always compare against time of previous guess)


git-svn-id: http://svn.annodex.net/liboggz/trunk@776 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 0f503d3d
......@@ -954,7 +954,7 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
oggz_off_t offset_orig, offset_at, offset_guess;
oggz_off_t offset_begin, offset_end = -1, offset_next;
ogg_int64_t granule_at;
ogg_int64_t unit_at, unit_begin = 0, unit_end = -1;
ogg_int64_t unit_at, unit_begin = 0, unit_end = -1, unit_last_iter = -1;
long serialno;
ogg_page * og;
int looping = 0;
......@@ -1036,6 +1036,8 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
for ( ; ; ) {
unit_last_iter = unit_at;
#ifdef DEBUG
printf ("oggz_seek_set: [A] want u%lld: (u%lld - u%lld) [@%ld - @%ld]\n",
unit_target, unit_begin, unit_end, offset_begin, offset_end);
......@@ -1067,7 +1069,6 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
looping = 1;
}
offset_at = oggz_seek_raw (oggz, offset_guess, SEEK_SET);
if (offset_at == -1) {
goto notfound;
......@@ -1094,7 +1095,7 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
}
if (offset_next < 0) {
looping = 1;
goto notfound;
}
if (offset_next > offset_end) {
......@@ -1115,6 +1116,8 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
unit_at = oggz_get_unit (oggz, serialno, granule_at);
if (unit_at == unit_last_iter) looping = 1;
#ifdef DEBUG
printf ("oggz_seek_set: [D] want u%lld, got page u%lld @%ld g%lld\n",
unit_target, unit_at, offset_at, granule_at);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment