From 9bd15919a7dd2f71b93d142cbb920c781d3fc872 Mon Sep 17 00:00:00 2001 From: Joo Aun Saw Date: Fri, 21 Jun 2019 13:30:54 +1000 Subject: [PATCH] motion: fix bitrate overflow --- package/motion/fix_bitrate_overflow.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package/motion/fix_bitrate_overflow.patch diff --git a/package/motion/fix_bitrate_overflow.patch b/package/motion/fix_bitrate_overflow.patch new file mode 100644 index 0000000000..598131d14e --- /dev/null +++ b/package/motion/fix_bitrate_overflow.patch @@ -0,0 +1,13 @@ +diff --git a/ffmpeg.c b/ffmpeg.c +index a8afa6e..3f731ca 100644 +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -558,7 +558,7 @@ static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){ + if ((strcmp(ffmpeg->codec->name, "h264_omx") == 0) || (strcmp(ffmpeg->codec->name, "mpeg4_omx") == 0)) { + // H264 OMX encoder quality can only be controlled via bit_rate + // bit_rate = ffmpeg->width * ffmpeg->height * ffmpeg->fps * quality_factor +- ffmpeg->quality = (ffmpeg->width * ffmpeg->height * ffmpeg->fps * ffmpeg->quality) >> 7; ++ ffmpeg->quality = (int)(((int64_t)ffmpeg->width * ffmpeg->height * ffmpeg->fps * ffmpeg->quality) >> 7); + // Clip bit rate to min + if (ffmpeg->quality < 4000) // magic number + ffmpeg->quality = 4000;