[xiph-commits] r3249 - liboggz/trunk/src/liboggz

shans at svn.annodex.net shans at svn.annodex.net
Fri Oct 5 22:40:14 PDT 2007


Author: shans
Date: 2007-10-05 22:40:13 -0700 (Fri, 05 Oct 2007)
New Revision: 3249

Modified:
   liboggz/trunk/src/liboggz/oggz_auto.c
   liboggz/trunk/src/liboggz/oggz_read.c
Log:
possible fix for Ian Malone's segfault bug.
ogg_int64_t variable fixed in oggz_read.c



Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c	2007-10-06 05:20:59 UTC (rev 3248)
+++ liboggz/trunk/src/liboggz/oggz_auto.c	2007-10-06 05:40:13 UTC (rev 3249)
@@ -444,6 +444,7 @@
 
 }
 
+static ogg_int64_t
 auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream, 
                   ogg_packet *this_packet, ogg_packet *next_packet) {
 

Modified: liboggz/trunk/src/liboggz/oggz_read.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_read.c	2007-10-06 05:20:59 UTC (rev 3248)
+++ liboggz/trunk/src/liboggz/oggz_read.c	2007-10-06 05:40:13 UTC (rev 3249)
@@ -298,7 +298,7 @@
 
   OggzBufferedPacket *p = (OggzBufferedPacket *)elem;
   ogg_int64_t gp_stored;
-  long unit_stored;
+  ogg_int64_t unit_stored;
 
   if (p->calced_granulepos == -1) {
     return DLIST_ITER_CANCEL;
@@ -437,43 +437,45 @@
           if (stream->packetno == 1) {
             oggz_auto_read_comments (oggz, stream, serialno, op);
           }
-
-          /*
-           * 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)) {
+          
+          if (oggz->flags & OGGZ_AUTO) {
+          
             /*
-             * 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)) {
+             * 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, &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 
+               */
+              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) {



More information about the commits mailing list