[Ffmpeg-devel] [PATCH] Ratecontrol does not check for failure of ff_eval
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
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...
Size: 5568 bytes
Desc: not available
More information about the ffmpeg-devel