[Ffmpeg-devel] [PATCH] Ratecontrol does not check for failure of ff_eval

Panagiotis Issaris takis.issaris
Tue Sep 26 14:40:40 CEST 2006


Hi,

Op maandag 25 september 2006 16:20, schreef Michael Niedermayer:
> > >[...]
> > > > I'd think propagating the error would be the best thing to do, so the
> > > > calling application can handle the error as it pleases. Would a patch
> > > > propagating the NAN upwards be okay?
> > > 
> > > yes (or -1 or something like that)
> > 
> > The attached patch tries to add failure handling in case ff_eval fails.  It is _not 
> > meant for inclusion_ though, as it is incorrect at the moment. 
> > 
> > One problem is, that FFmpeg does not quit when avcodec_encode_video() returns -1. I 
> > added this in the patch, and it is most likely incorrect as there are also two other 
> > reasons for returning -1, being:
> > * buf_size < FF_MIN_BUFFER_SIZE
> > * if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
> 
> hmm, these are as fatal as a nonsense rc_eq so exiting in some way from
> ffmpeg.c seems appropriate

Patch attached which prints an error message when avcodec_encode_video() fails and exits.

 ffmpeg.c                 |    4 ++++
 libavcodec/mpegvideo.c   |   21 ++++++++++++++-------
 libavcodec/ratecontrol.c |    6 ++++++
 libavcodec/snow.c        |   12 ++++++++++--
 4 files changed, 34 insertions(+), 9 deletions(-)

> > How do you feel about returning differing negative values for different failures? So,
> 
> ive no objection if its usefull and doesnt become too bloated (=like having tables of
> strings with error messages and such)

How about a file containing defines like these?
#define AV_ERR_BUFSIZE_TOO_SMALL -256
#define AV_ERR_DIMENSION_INVALID -257
...

If so, should we start from a certain number to be able to reuse defines like ENOMEM?
If so, should we then also define them as positive and return -ENOMEM, like some 
other projects do?

With friendly regards,
Takis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20060926T141808-ffmpeg-handle_eval_failure.diff
Type: text/x-diff
Size: 5566 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060926/5a2eafc2/attachment.diff>



More information about the ffmpeg-devel mailing list