Commit 757dbdc2 authored by shans's avatar shans

possible fix for Ian Malone's segfault bug.

ogg_int64_t variable fixed in oggz_read.c



git-svn-id: http://svn.annodex.net/liboggz/trunk@3249 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent eea88d10
...@@ -444,6 +444,7 @@ auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) { ...@@ -444,6 +444,7 @@ auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
} }
static ogg_int64_t
auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream, auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream,
ogg_packet *this_packet, ogg_packet *next_packet) { ogg_packet *this_packet, ogg_packet *next_packet) {
......
...@@ -298,7 +298,7 @@ oggz_read_deliver_packet(void *elem) { ...@@ -298,7 +298,7 @@ oggz_read_deliver_packet(void *elem) {
OggzBufferedPacket *p = (OggzBufferedPacket *)elem; OggzBufferedPacket *p = (OggzBufferedPacket *)elem;
ogg_int64_t gp_stored; ogg_int64_t gp_stored;
long unit_stored; ogg_int64_t unit_stored;
if (p->calced_granulepos == -1) { if (p->calced_granulepos == -1) {
return DLIST_ITER_CANCEL; return DLIST_ITER_CANCEL;
...@@ -437,43 +437,45 @@ oggz_read_sync (OGGZ * oggz) ...@@ -437,43 +437,45 @@ oggz_read_sync (OGGZ * oggz)
if (stream->packetno == 1) { if (stream->packetno == 1) {
oggz_auto_read_comments (oggz, stream, serialno, op); oggz_auto_read_comments (oggz, stream, serialno, op);
} }
/* if (oggz->flags & OGGZ_AUTO) {
* while we are getting invalid granulepos values, store the incoming
* packets in a dlist */
if (reader->current_granulepos == -1) {
OggzBufferedPacket *p = oggz_read_new_pbuffer_entry(
oggz, &packet, reader->current_granulepos,
serialno, stream, reader);
oggz_dlist_append(oggz->packet_buffer, p);
continue;
} else if (!oggz_dlist_is_empty(oggz->packet_buffer)) {
/*
* move backward through the list assigning gp values based upon
* the granulepos we just recieved. Then move forward through
* the list delivering any packets at the beginning with valid
* gp values
*/
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet);
/* /*
* fix up the stream granulepos * while we are getting invalid granulepos values, store the
*/ * incoming packets in a dlist */
stream->last_granulepos = gp_stored; if (reader->current_granulepos == -1) {
if (!oggz_dlist_is_empty(oggz->packet_buffer)) {
OggzBufferedPacket *p = oggz_read_new_pbuffer_entry( OggzBufferedPacket *p = oggz_read_new_pbuffer_entry(
oggz, &packet, reader->current_granulepos, oggz, &packet, reader->current_granulepos,
serialno, stream, reader); serialno, stream, reader);
oggz_dlist_append(oggz->packet_buffer, p); oggz_dlist_append(oggz->packet_buffer, p);
continue; continue;
} else if (!oggz_dlist_is_empty(oggz->packet_buffer)) {
/*
* move backward through the list assigning gp values based upon
* the granulepos we just recieved. Then move forward through
* the list delivering any packets at the beginning with valid
* gp values
*/
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet);
/*
* fix up the stream granulepos
*/
stream->last_granulepos = gp_stored;
if (!oggz_dlist_is_empty(oggz->packet_buffer)) {
OggzBufferedPacket *p = oggz_read_new_pbuffer_entry(
oggz, &packet, reader->current_granulepos,
serialno, stream, reader);
oggz_dlist_append(oggz->packet_buffer, p);
continue;
}
} }
} }
if (stream->read_packet) { if (stream->read_packet) {
......
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