[FFmpeg-devel] [PATCH] Fix Ogg data_offset computation.

Aaron Colwell acolwell
Mon Nov 22 19:43:08 CET 2010


On Mon, Nov 22, 2010 at 10:36 AM, Reimar D?ffinger <Reimar.Doeffinger at gmx.de
> wrote:

> > diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> > index 5e52bb3..1b85eeb 100644
> > --- a/libavformat/oggdec.c
> > +++ b/libavformat/oggdec.c
> > @@ -373,9 +373,14 @@ ogg_packet (AVFormatContext * s, int *str, int
> *dstart, int *dsize, int64_t *fpo
> >          if (!os->header){
> >              os->segp = segp;
> >              os->psize = psize;
> > -            if (!ogg->headers)
> > -                s->data_offset = os->sync_pos;
> > -            ogg->headers = 1;
> > +            if (!ogg->headers) {
> > +                if (!s->data_offset || s->data_offset > os->sync_pos)
> > +                    s->data_offset = os->sync_pos;
> > +                ogg->headers = 1;
> > +                for (i = 0; ogg->headers && i < ogg->nstreams; i++)
> > +                    if (ogg->streams[i].header > 0)
> > +                        ogg->headers = 0;
> > +            }
>
> Sorry, but I am not able to understand you patch.
> To me it looks like it still updates data_offset multiple times, what
> ensures that the application/seek framework never sees one of
> those wrong values?
>

data_offset is updated multiple times, but only while the headers are
being parsed. My assumption is that the seeking logic isn't invoked
until after the headers have been successfully read (ie before
ogg_read_header() is called and returns). Is that a bad assumption?

Aaron



More information about the ffmpeg-devel mailing list