diff mbox

[FFmpeg-devel] lavc/libx264: bit_rates > INT_MAX are not supported

Message ID CAB0OVGrPqSif6khZ4ZAXgJ0voQBJOVmEKRxQmqcH9di_9bEikA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Aug. 10, 2019, 3:10 p.m. UTC
Am Sa., 10. Aug. 2019 um 16:54 Uhr schrieb Hendrik Leppkes
<h.leppkes@gmail.com>:
>
> On Sat, Aug 10, 2019 at 2:43 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> >
> > Hi!
> >
> > Attached patch fixes ticket #8071.
> >
>
> You could allow the full range of bit_rate since its immediately
> divided by 1000, couldn't you?

New patch attached, unrelated to ticket #8071.

Thank you, Carl Eugen

Comments

Hendrik Leppkes Aug. 10, 2019, 3:35 p.m. UTC | #1
On Sat, Aug 10, 2019 at 5:11 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> Am Sa., 10. Aug. 2019 um 16:54 Uhr schrieb Hendrik Leppkes
> <h.leppkes@gmail.com>:
> >
> > On Sat, Aug 10, 2019 at 2:43 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> > >
> > > Hi!
> > >
> > > Attached patch fixes ticket #8071.
> > >
> >
> > You could allow the full range of bit_rate since its immediately
> > divided by 1000, couldn't you?
>
> New patch attached, unrelated to ticket #8071.
>

LGTM.

- Hendrik
Carl Eugen Hoyos Aug. 10, 2019, 9:28 p.m. UTC | #2
Am Sa., 10. Aug. 2019 um 17:36 Uhr schrieb Hendrik Leppkes
<h.leppkes@gmail.com>:
>
> On Sat, Aug 10, 2019 at 5:11 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> >
> > Am Sa., 10. Aug. 2019 um 16:54 Uhr schrieb Hendrik Leppkes
> > <h.leppkes@gmail.com>:
> > >
> > > On Sat, Aug 10, 2019 at 2:43 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> > > >
> > > > Hi!
> > > >
> > > > Attached patch fixes ticket #8071.
> > > >
> > >
> > > You could allow the full range of bit_rate since its immediately
> > > divided by 1000, couldn't you?
> >
> > New patch attached, unrelated to ticket #8071.
> >
>
> LGTM.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 8fd6cc5727b824572ba2147dfeec6f00520c9f69 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sat, 10 Aug 2019 14:40:23 +0200
Subject: [PATCH] lavc/libx264: bit_rates > INT_MAX are not supported.
---
 libavcodec/libx264.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index dc4b4b100d..ea44cc38c6 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -594,6 +594,10 @@  static av_cold int X264_init(AVCodecContext *avctx)
     PARSE_X264_OPT("weightp", wpredp);
 
     if (avctx->bit_rate) {
+        if (avctx->bit_rate / 1000 > INT_MAX || avctx->rc_max_rate / 1000 > INT_MAX) {
+            av_log(avctx, AV_LOG_ERROR, "bit_rate and rc_max_rate > %d000 not supported by libx264\n", INT_MAX);
+            return AVERROR(EINVAL);
+        }
         x4->params.rc.i_bitrate   = avctx->bit_rate / 1000;
         x4->params.rc.i_rc_method = X264_RC_ABR;
     }
-- 
2.22.0