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

Reimar Döffinger Reimar.Doeffinger
Thu Nov 18 21:15:05 CET 2010


On Thu, Nov 18, 2010 at 10:04:34AM -0800, Aaron Colwell wrote:
> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index 5e52bb3..87f4cf4 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -373,7 +373,7 @@ 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)
> +            if (!ogg->headers || s->data_offset > os->sync_pos)
>                  s->data_offset = os->sync_pos;
>              ogg->headers = 1;

If (in your example) only the first audio packet is demuxed and then
a seek is done, the video packet will never be demuxer and thus
data_offset will stay wrong.
A proper fix means you have to set data_offset already when the
first packet is read/parsed.
Concerning "valid Ogg file or not" I can only think, valid it may be,
it just would be nice to find something one could call a "sane Ogg file".



More information about the ffmpeg-devel mailing list