[FFmpeg-cvslog] r25846 - trunk/libavformat/oggdec.c

reimar subversion
Mon Nov 29 20:02:28 CET 2010


Author: reimar
Date: Mon Nov 29 20:02:28 2010
New Revision: 25846

Log:
Ensure that data_offset is set correctly when there are partial
data packets before the first complete one.
Patch by Aaron Colwell [acolwell chromium org].

Modified:
   trunk/libavformat/oggdec.c

Modified: trunk/libavformat/oggdec.c
==============================================================================
--- trunk/libavformat/oggdec.c	Mon Nov 29 17:38:12 2010	(r25845)
+++ trunk/libavformat/oggdec.c	Mon Nov 29 20:02:28 2010	(r25846)
@@ -373,9 +373,27 @@ ogg_packet (AVFormatContext * s, int *st
         if (!os->header){
             os->segp = segp;
             os->psize = psize;
-            if (!ogg->headers)
-                s->data_offset = os->sync_pos;
+
+            // We have reached the first non-header packet. All header
+            // packets must be complete before the first non-header
+            // one, so everything that follows must be non-header.
             ogg->headers = 1;
+
+            // Update the header state for all streams and
+            // compute the data_offset.
+            s->data_offset = os->sync_pos;
+            for (i = 0; i < ogg->nstreams; i++) {
+                struct ogg_stream *cur_os = ogg->streams + i;
+                // Set stream header state to 0 if its last packet
+                // was a header.
+                if (cur_os->header > 0)
+                    cur_os->header = 0;
+
+                // if we have a partial non-header packet, its start is
+                // obviously at or after the data start
+                if (cur_os->incomplete)
+                    s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos);
+            }
         }else{
             os->pstart += os->psize;
             os->psize = 0;



More information about the ffmpeg-cvslog mailing list