1 diff --git a/mozilla/media/liboggz/src/liboggz/oggz_seek.c b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
2 index f933d4d..23ffb57 100644
3 --- a/mozilla/media/liboggz/src/liboggz/oggz_seek.c
4 +++ b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
5 @@ -486,16 +486,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
6 serialno = ogg_page_serialno (og);
7 granule_at = ogg_page_granulepos (og);
8 unit_at = oggz_get_unit (oggz, serialno, granule_at);
13 offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
14 + if (offset_at == -1)
16 unit_at = oggz_get_unit(oggz, serialno, granule_at);
17 } while (unit_at > unit_target);
20 } else if (unit_at == unit_target) {
22 printf (" scan: (%lld) == (%lld)\n", unit_at, unit_target);
24 @@ -552,16 +554,19 @@ oggz_seek_guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
25 printf ("oggz_seek_guess: unit_end <= unit_begin (ERROR)\n");
29 offset_guess = guess (unit_at, unit_target, unit_begin, unit_end,
30 offset_begin, offset_end);
33 + if (offset_end != -1 && guess >= offset_end)
34 + offset_guess = offset_begin + (offset_end - offset_begin)/2;
37 printf ("oggz_seek_guess: guessed %" PRI_OGGZ_OFF_T "d\n", offset_guess);
44 @@ -759,16 +764,18 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
52 offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
53 + if (offset_at == -1)
55 unit_at = oggz_get_unit (oggz, serialno, granule_at);
56 } while (unit_at > unit_target);
59 oggz_reset (oggz, offset_orig, -1, SEEK_SET);