Bug 480063 - Update liboggz and liboggplay to fix infinite loop bug - rs=roc

--HG--
extra : rebase_source : e05260747e635675fda3eb7bbaee4d1d3df85fcb
This commit is contained in:
Chris Double 2009-05-12 15:27:23 +12:00
Родитель 2168da902e
Коммит 7880c539a7
16 изменённых файлов: 97 добавлений и 29 удалений

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

@ -14,3 +14,4 @@ bug485291_yuv_align: only use optimized YUV routines if video dimensions are a m
endian: pick up NSPR's little/big endian defines in oggplay's config.h.
trac466: Fix for infinite loop in liboggplay when running decoder on its own thread.

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

@ -708,14 +708,15 @@ read_more_data:
oggplay_data_clean_list (me->decode_data[i]);
}
if (me->shutdown) {
return E_OGGPLAY_OK;
}
if (info == NULL) {
goto read_more_data;
}
me->target += me->callback_period;
if (me->shutdown) {
return E_OGGPLAY_OK;
}
if (r == -1) {
return E_OGGPLAY_USER_INTERRUPT;
}

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

@ -0,0 +1,23 @@
diff --git a/media/liboggplay/src/liboggplay/oggplay.c b/media/liboggplay/src/liboggplay/oggplay.c
index 3296fea..d6256c6 100644
--- a/media/liboggplay/src/liboggplay/oggplay.c
+++ b/media/liboggplay/src/liboggplay/oggplay.c
@@ -708,14 +708,15 @@ read_more_data:
oggplay_data_clean_list (me->decode_data[i]);
}
+ if (me->shutdown) {
+ return E_OGGPLAY_OK;
+ }
+
if (info == NULL) {
goto read_more_data;
}
me->target += me->callback_period;
- if (me->shutdown) {
- return E_OGGPLAY_OK;
- }
if (r == -1) {
return E_OGGPLAY_USER_INTERRUPT;
}

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

@ -46,4 +46,4 @@ rm ./src/liboggplay/oggplay_private.h1
sed s/\#ifdef\ HAVE_INTTYPES_H/\#if\ HAVE_INTTYPES_H/g $1/src/liboggplay/oggplay_data.c >./src/liboggplay/oggplay_data.c
patch -p3 < bug485291_yuv_align.patch
patch -p3 < endian.patch
patch -p3 < trac466.patch

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

@ -23,6 +23,9 @@ Ian Malone
- oggz_comment_generate(), oggz_comment_set_vendor(),
oggz_packet_destroy(), FLAC header fixes
ogg.k.ogg.k
- Kate support, many bugfixes
Mike Smith
- examples/fix-eos.c, page-level validation in oggz-validate

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

@ -110,8 +110,8 @@ oggz tool
Usage: oggz <subcommand> [options] filename ...
oggz is a commandline tool for manipulating Ogg files. It supports
multiplexed files conformant with RFC3533. Oggz can parse headers for
CELT, CMML, FLAC, Kate, PCM, Speex, Theora and Vorbis, and can read and write
multiplexed files conformant with RFC3533. Oggz can parse headers for CELT,
CMML, Dirac, FLAC, Kate, PCM, Speex, Theora and Vorbis, and can read and write
Ogg Skeleton logical bitstreams.
Commands:

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

@ -4,7 +4,7 @@ were those applied by update.sh, which applies patches described
below, and the addition/upate of Makefile.in files for the
Mozilla build system.
The git commit id used was ef3b0e from git://git.xiph.org/liboggz.git
The git commit id used was 7df1eb from git://git.xiph.org/liboggz.git
The wince.patch addresses the lack of posix file IO support on windows ce,
see bug 461844 for details.

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

@ -4,6 +4,9 @@
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define if the compiler implements enums as signed values. */
/* #undef ALLOW_SIGNED_ENUMS */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@ -67,7 +70,7 @@
#define OGGZ_OFF_MAX 0x7FFFFFFFFFFFFFFFLL
/* Define if <ogg/ogg.h> is const-correct */
/* #undef OGG_H_CONST_CORRECT */
#define OGG_H_CONST_CORRECT /**/
/* Name of package */
#define PACKAGE "liboggz"
@ -106,7 +109,7 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.9.8"
#define VERSION "0.9.9"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */

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

@ -38,6 +38,8 @@
#include "oggz_private.h"
#include <oggz/oggz_stream.h>
static ogg_int64_t
oggz_metric_dirac (OGGZ * oggz, long serialno,
ogg_int64_t granulepos, void * user_data)

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

@ -662,7 +662,11 @@ oggz_content_type (OggzStreamContent content)
* GCC gives a warning for it -- other compilers (including earlier GCC
* versions) may use a signed type for enum OggzStreamContent.
*/
if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN)
if (
#ifdef ALLOW_SIGNED_ENUMS
content < OGGZ_CONTENT_THEORA ||
#endif
content >= OGGZ_CONTENT_UNKNOWN)
return NULL;
return oggz_auto_codec_ident[content].content_type;

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

@ -64,7 +64,6 @@ int oggz_set_metric_linear (OGGZ * oggz, long serialno,
#define INT16_BE_AT(x) _be_16((*(ogg_int32_t *)(x)))
#define INT32_LE_AT(x) _le_32((*(ogg_int32_t *)(x)))
#define INT32_BE_AT(x) _be_32((*(ogg_int32_t *)(x)))
#define INT64_LE_AT(x) _le_64((*(ogg_int64_t *)(x)))
static int
@ -150,8 +149,8 @@ auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void
/* TODO: this should check against 42 for the relevant version numbers */
if (length < 41) return 0;
fps_numerator = INT32_BE_AT(&header[22]);
fps_denominator = INT32_BE_AT(&header[26]);
fps_numerator = int32_be_at(&header[22]);
fps_denominator = int32_be_at(&header[26]);
/* Very old theora versions used a value of 0 to mean 1.
* Unfortunately theora hasn't incremented its version field,
@ -269,7 +268,7 @@ auto_oggpcm2 (OGGZ * oggz, long serialno, unsigned char * data, long length, voi
if (length < 28) return 0;
granule_rate = (ogg_int64_t) INT32_BE_AT(&header[16]);
granule_rate = (ogg_int64_t) int32_be_at(&header[16]);
#ifdef DEBUG
printf ("Got OggPCM2 rate %d\n", (int)granule_rate);
#endif

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

@ -117,4 +117,10 @@ _le_64 (ogg_int64_t l)
return (*(ogg_int64_t *)ucptr);
}
static ogg_int32_t
int32_be_at (unsigned char *c)
{
return (c [0] << 24) + (c [1] << 16) + (c [2] << 8) + c [3] ;
}
#endif /* __OGGZ_BYTEORDER_H__ */

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

@ -139,6 +139,7 @@ struct _OggzReader {
ogg_int64_t current_unit;
ogg_int64_t current_granulepos;
long current_page_bytes;
#if 0
oggz_off_t offset_page_end; /* offset of end of current page */
#endif

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

@ -90,6 +90,8 @@ oggz_read_init (OGGZ * oggz)
reader->current_unit = 0;
reader->current_page_bytes = 0;
return oggz;
}
@ -187,26 +189,33 @@ oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
oggz_off_t page_offset = 0, ret;
int found = 0;
/* Increment oggz->offset by length of the last page processed */
oggz->offset += reader->current_page_bytes;
do {
more = ogg_sync_pageseek (&reader->ogg_sync, og);
if (more == 0) {
/* No page available */
page_offset = 0;
return -2;
} else if (more < 0) {
#ifdef DEBUG_VERBOSE
printf ("get_next_page: skipped %ld bytes\n", -more);
#endif
page_offset -= more;
page_offset += (-more);
oggz->offset += (-more);
} else {
#ifdef DEBUG_VERBOSE
printf ("get_next_page: page has %ld bytes\n", more);
#endif
reader->current_page_bytes = more;
found = 1;
}
} while (!found);
#if 0 /* This is now done by the increment at the top of the file */
/* Calculate the byte offset of the page which was found */
if (bytes > 0) {
oggz->offset = oggz_io_tell (oggz) - bytes + page_offset;
@ -218,6 +227,9 @@ oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
}
return ret;
#else
return oggz->offset;
#endif
}
typedef struct {
@ -364,8 +376,10 @@ oggz_read_sync (OGGZ * oggz)
#ifdef DEBUG
printf ("oggz_read_sync: hole in the data\n");
#endif
/* We can't tolerate holes in headers, so bail out. */
if (stream->packetno < 3) return OGGZ_ERR_HOLE_IN_DATA;
/* We can't tolerate holes in headers, so bail out. NB. as stream->packetno
* has not yet been incremented, the current value refers to how many packets
* have been processed prior to this one. */
if (stream->packetno < 2) return OGGZ_ERR_HOLE_IN_DATA;
/* Holes in content occur in some files and pretty much don't matter,
* so we silently swallow the notification and reget the packet.

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

@ -483,8 +483,6 @@ 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 == -1)
return -1;
unit_at = oggz_get_unit(oggz, serialno, granule_at);
} while (unit_at > unit_target);
return offset_at;
@ -512,9 +510,15 @@ guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
if (unit_at == unit_begin) return offset_begin;
guess_ratio =
GUESS_MULTIPLIER * (unit_target - unit_begin) /
(unit_at - unit_begin);
if (unit_end != -1) {
guess_ratio =
GUESS_MULTIPLIER * (unit_target - unit_begin) /
(unit_end - unit_begin);
} else {
guess_ratio =
GUESS_MULTIPLIER * (unit_target - unit_begin) /
(unit_at - unit_begin);
}
#ifdef DEBUG
printf ("oggz_seek::guess: guess_ratio %lld = (%lld - %lld) / (%lld - %lld)\n",
@ -551,9 +555,6 @@ oggz_seek_guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
offset_begin, offset_end);
}
if (offset_end != -1 && guess >= offset_end)
offset_guess = offset_begin + (offset_end - offset_begin)/2;
#ifdef DEBUG
printf ("oggz_seek_guess: guessed %" PRI_OGGZ_OFF_T "d\n", offset_guess);
#endif
@ -675,7 +676,16 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
unit_at = reader->current_unit;
unit_begin = 0;
unit_end = -1;
og = &oggz->current_page;
if (oggz_seek_raw (oggz, 0, SEEK_END) >= 0) {
ogg_int64_t granulepos;
if (oggz_get_prev_start_page (oggz, og, &granulepos, &serialno) >= 0) {
unit_end = oggz_get_unit (oggz, serialno, granulepos);
}
}
og = &oggz->current_page;
@ -700,6 +710,10 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
break;
}
if (offset_guess > offset_end) {
offset_guess = offset_end;
}
offset_at = oggz_seek_raw (oggz, offset_guess, SEEK_SET);
if (offset_at == -1) {
goto notfound;
@ -772,8 +786,6 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
found:
do {
offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
if (offset_at == -1)
break;
unit_at = oggz_get_unit (oggz, serialno, granule_at);
} while (unit_at > unit_target);

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

@ -46,4 +46,3 @@ sed s/\#include\ \"config.h\"/\#ifdef\ WIN32\\n\#include\ \"config_win32.h\"\\n\
cp $1/AUTHORS ./AUTHORS
patch -p3 <wince.patch
patch -p3 <endian.patch
patch -p4 <seek.patch