aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis.issaris@uhasselt.be>2006-09-26 14:04:36 +0000
committerPanagiotis Issaris <takis.issaris@uhasselt.be>2006-09-26 14:04:36 +0000
commit4156a436e37fb387da60fd919d6efa8ee71e1a0f (patch)
tree7a656df606c85c37abd96ca74767ba27920b0827 /libavcodec/ratecontrol.c
parent327409d7b9a3fdb87c113093f15ca69dccdbe5b5 (diff)
downloadffmpeg-4156a436e37fb387da60fd919d6efa8ee71e1a0f.tar.gz
Handle possible failure of ff_eval.
Originally committed as revision 6338 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r--libavcodec/ratecontrol.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 02108248ec..5c339fa152 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -326,6 +326,10 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
};
bits= ff_eval(s->avctx->rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce);
+ if (isnan(bits)) {
+ av_log(s->avctx, AV_LOG_ERROR, "Unable to parse rc_eq \"%s\".\n", s->avctx->rc_eq);
+ return -1;
+ }
rcc->pass1_rc_eq_output_sum+= bits;
bits*=rate_factor;
@@ -726,6 +730,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
rate_factor= rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum * br_compensation;
q= get_qscale(s, rce, rate_factor, picture_number);
+ if (q < 0)
+ return -1;
assert(q>0.0);
//printf("%f ", q);