[FFmpeg-devel] [PATCH] mjpegdec: ensure SOF before SOS/EOI
Fri Jul 3 16:00:12 CEST 2009
On Fri, Jul 03, 2009 at 01:38:15PM +0000, Jai Menon wrote:
> On Fri, Jul 3, 2009 at 1:32 PM, Reimar
> D?ffinger<Reimar.Doeffinger at gmx.de> wrote:
> > On Wed, Jul 01, 2009 at 08:21:05PM +0000, Jai Menon wrote:
> >> On Wed, Jul 1, 2009 at 8:15 PM, Reimar
> >> D?ffinger<Reimar.Doeffinger at gmx.de> wrote:
> >> > this fixes issue1240, mjpeg/smclockmjpeg.avi.1.0
> >> > The problem is, it reaches EOI before SOF, thus get_buffer was
> >> > never called and the picture it returns has invalid values for
> >> > data (NULL in this case, but it could be values from a previous
> >> > frame which still would be wrong).
> >> > This could also happen, if avcodec_check_dimensions failed, which
> >> > might make this even more of an issue.
> >> > Attached patch fixes it and also protects the decode_sos part so
> >> > it will only be called with a valid picture.
> >> A related patch has been posted where i'm using a similar flag to
> >> detect valid EOI markers, maybe we could somehow use the same flag.
> >> Just a thought.
> > Maybe, but I am sure not going to search for the patch to find out without
> > getting any hints
> Sorry, my bad. Patch can be found at . Again, I'm not 100% sure, so
> if you find it irrelevant, please disregard.
>  http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/93270
I think that's a broken version of my patch. Yours only works by pure
luck because the invalid frames also lack a SOI.
The missing SOI is not really an issue for FFmpeg (except probably
breaking the restart code and thus possibly decoding incorrectly - and I
do think that s->restart_interval and s->restart_count are only reset on
SOI instead of at the start of decode_frame is a bug), the
real issue that causes the crash is a missing SOF.
And yes, I tested that my patch actually fixes issue 839.
More information about the ffmpeg-devel