Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2019-08-30 02:00:50 +0300
committerAman Gupta <aman@tmm1.net>2019-09-02 23:46:11 +0300
commitb022d9ba288ad3de321e0835b0aedfd91c2c3064 (patch)
treedaf6532bcc8c5db9a1f648144a7d60952025c4c3 /libavcodec/omx.c
parentf4eb7d84a7c219eac130750417e4bc2cbbff7b3f (diff)
avcodec/omx: fix xFramerate calculation
Integer overflow in the Q16 framerate calculation was sending invalid values to the OMX encoder. On the RPI4, this manifested as bitrate controls being ignored on video streams with 60000/1001 framerates. Video streams with 30000/1001 framerates were not affected. Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/omx.c')
-rw-r--r--libavcodec/omx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index 837f5df666..0a6a308309 100644
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -473,9 +473,9 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
in_port_params.format.video.nFrameWidth = avctx->width;
in_port_params.format.video.nFrameHeight = avctx->height;
if (avctx->framerate.den > 0 && avctx->framerate.num > 0)
- in_port_params.format.video.xFramerate = (1 << 16) * avctx->framerate.num / avctx->framerate.den;
+ in_port_params.format.video.xFramerate = (1LL << 16) * avctx->framerate.num / avctx->framerate.den;
else
- in_port_params.format.video.xFramerate = (1 << 16) * avctx->time_base.den / avctx->time_base.num;
+ in_port_params.format.video.xFramerate = (1LL << 16) * avctx->time_base.den / avctx->time_base.num;
err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, &in_port_params);
CHECK(err);