Fixes: error: 1.66789e+11 is outside the range of representable values of type 'int' Fixes: Ticket8201
Unified · Split
| @@ -463,9 +463,13 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 462 unmodified lines | ||
| 463 | 463 | if (!s->fixed_qscale && |
| 464 | 464 | avctx->bit_rate * av_q2d(avctx->time_base) > |
| 465 | 465 | avctx->bit_rate_tolerance) { |
| 466 | + double nbt = avctx->bit_rate * av_q2d(avctx->time_base) * 5; | |
| 466 | 467 | av_log(avctx, AV_LOG_WARNING, |
| 467 | 468 | "bitrate tolerance %d too small for bitrate %"PRId64", overriding\n", avctx->bit_rate_tolerance, avctx->bit_rate); |
| 468 | − avctx->bit_rate_tolerance = 5 * avctx->bit_rate * av_q2d(avctx->time_base); | |
| 469 | + if (nbt <= INT_MAX) { | |
| 470 | + avctx->bit_rate_tolerance = nbt; | |
| 471 | + } else | |
| 472 | + avctx->bit_rate_tolerance = INT_MAX; | |
| 469 | 473 | } |
| 470 | 474 | |
| 471 | 475 | if (avctx->rc_max_rate && |