aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-08-23 17:57:21 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-08-23 21:44:38 +0200
commit167ea1fbf15ecefa30729f9b8d091ed431bf43bd (patch)
treedca8399e20948bc743d95b7bce8459ea12c405c9
parent61d8fa2a1ab76f0f3ac1442faa104ace4b29decc (diff)
downloadffmpeg-167ea1fbf15ecefa30729f9b8d091ed431bf43bd.tar.gz
xavs: Do not try to set the bitrate tolerance without a bitrate
Avoid a division by zero. Bug-Id: CID 1257655
-rw-r--r--libavcodec/libxavs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index f0f5dfdcd3..43b0915c52 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -356,8 +356,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (avctx->level > 0)
x4->params.i_level_idc = avctx->level;
- x4->params.rc.f_rate_tolerance =
- (float)avctx->bit_rate_tolerance/avctx->bit_rate;
+ if (avctx->bit_rate > 0)
+ x4->params.rc.f_rate_tolerance =
+ (float)avctx->bit_rate_tolerance / avctx->bit_rate;
if ((avctx->rc_buffer_size) &&
(avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {