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

Panagiotis Issaris takis.issaris
Mon Sep 25 15:20:47 CEST 2006


Op zondag 24 september 2006 14:57, schreef Michael Niedermayer:
> > On zo, 2006-09-24 at 13:02 +0200, Michael Niedermayer wrote:
> > > > The attached patch handles failure in the ratecontroller in case ff_eval
> > > > failed. It does so, by reverting to the default rc_eq in case an invalid
> > > > one is specified. Regression tests succeed.
> > 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))

How do you feel about returning differing negative values for different failures? So,
checking <0 would still catch all failures, but, it would at least be possible to get
idea what happened and handle it from outside of libavcodec.

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

With friendly regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pi-20060925T150746-ffmpeg-handle_eval_failure.diff
Type: text/x-diff
Size: 5568 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060925/3221243d/attachment.diff>

More information about the ffmpeg-devel mailing list