[FFmpeg-devel] [PATCH] oggdec: do not set time_base to invalid value

Måns Rullgård mans
Thu Jan 20 23:38:49 CET 2011


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> Hello,
> possible we should consider catching this at a higher level, and possibly
> st->codec->sample_rate should not be assigned an invalid value either...
> Vorbis ogg parser may set st->time_base.den to 0, causing an
> assertion failure in av_rescale_* during av_update_stream_timings.

This is a recurring theme.  It needs to be addressed in a better way.

> Below patch is one way to fix.
> Original bug report against MPlayer with sample files: http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1189
> Index: ffmpeg/libavformat/oggparsevorbis.c
> ===================================================================
> --- ffmpeg/libavformat/oggparsevorbis.c (revision 25928)
> +++ ffmpeg/libavformat/oggparsevorbis.c (working copy)
> @@ -250,6 +260,7 @@
>          st->codec->codec_id = CODEC_ID_VORBIS;
>
>          st->time_base.num = 1;
> +        if (st->codec->sample_rate > 0)
>          st->time_base.den = st->codec->sample_rate;

If the sample rate is invalid/unknown, time_base.num should be set to 0.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list