[FFmpeg-devel] [PATCH] avoid crashes if input stream size changes without using -r

Reimar Döffinger Reimar.Doeffinger
Mon Jul 6 14:54:17 CEST 2009

On Mon, Jul 06, 2009 at 02:29:21PM +0200, Michael Niedermayer wrote:
> On Mon, Jul 06, 2009 at 01:59:15PM +0200, Reimar D?ffinger wrote:
> > Overall it seems to me that doing the check in lavc will not save
> > applications using lavc much code (if any)...
> maybe, and iam not really suggestinng to solve the issue in any specific
> way, ive also already said that i dont know if we should support size
> changes in encoders, some like mpeg1/2 could do it though ...

All can do it if you close and reopen them. Except a bit of additional
code (and maybe even that only for badly designed applications), does
this have any disadvantage?

> > > also it could be used in decoders too catching changed w/h from demuxers
> > 
> > That seems like rather low priority to me, for any correct decoder there
> > shouldn't be any crashes since get_buffer gets them a buffer of the
> > right size (hopefully).
> I think i rememer that one codec at least did have a problem with that,
> also there are many other tables that are based on width and height like
> mb types, mv vectors, ...

Yes, I understand that it can be forgotten, I was pointing out the
difference that why decoders at least _can_ check, encoders simply
can't, no matter how carefully you code them, because there is _no_ way
they can get the size or pix_fmt of the frame they are encoding.

> its very easy to forget some of these, in that sense a regression test that
> tested size changes for all decoders would be great

Hm. vcodec copy to concatenate several input files encoded at different resolutions
might work to generate the test file? I've never tried that kind of thing...

More information about the ffmpeg-devel mailing list