[Ffmpeg-devel] [PATCH] Fix for the lol-ffplay.ogm testcase

Michael Niedermayer michaelni
Wed Feb 28 00:58:03 CET 2007


Hi

On Tue, Feb 27, 2007 at 11:51:55AM +0100, Alex Beregszaszi wrote:
> Hi,
> 
> > > > But I'd prefer to fix the calling code anyway. I'll check ffmpeg.c
> > > > during the lunch break.
> > > Excellent! :)
> > Ok, here is the problem:
> > - before calling sws_getContext(), ffmpeg tries to allocate a temporary
> > picture for the rescaled image, by calling avpicture_alloc() at line
> > 1622. Since the picture size is 0x0, avpicture_alloc() fails, and ffmpeg
> > jumps to the fail: label... Then, it tries to cleanup everything, and
> > sws_freeContext(NULL) is called. The problem here is that "goto fail" is
> > used instead of "exit()". The attached fix1.diff patch fixes the
> > problem.
> > If people do not like calling exit(), and prefer "goto fail", then
> > fix2.diff can be applied... Or we can just leave things as they are,
> > since sws_freeContext() now likes NULL as a parameter (but I still do
> > not like having ost->video_resample != 0 and ost->img_resample_ctx ==
> > NULL).
> > 
> > Anyway, looking at ffmpeg.c I realized that there are a lot of
> > inconsistencies in error handling:
> > - sometimes, "goto fail" is used
> > - some other times, "exit()" is directly called
> > - finally, there are cases in which av_abort() is called! (I think this
> > is wrong, because av_abort() should be an internal function, no?).
> > 
> > So, should we try to always use the same construct in case of error?
> > If yes, which one?
> > In my opinion, for errors happening during the initialization phase
> > there is not much point in using "goto fail", and I'd be for using
> > "exit()" (of course, for errors happening during the decoding /
> > encoding, "goto exit" is the correct thing to do).
> 
> What happened to this patch?

well it was hit by the mailiglist as bugtracker issue
the exit patch looks ok

about the more general question how to exit out, well calling exit where its
ok to do so and goto fail with cleanup (flushing out data from buffers or 
such) where exit is not ok seems like the correct thing to do ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070228/10e4e927/attachment.pgp>



More information about the ffmpeg-devel mailing list