diff mbox

[FFmpeg-devel,1/2] avformat/movenc: Switch mov_write_uuidprof_tag() to avg_frame_rate

Message ID 20161009013637.11328-1-michael@niedermayer.cc
State Accepted
Commit 21bffa93a6fc73e1f1859f8bc224409eaaf27658
Headers show

Commit Message

Michael Niedermayer Oct. 9, 2016, 1:36 a.m. UTC
Using the stream timebase simply overflows
Fix integer overflow in psp framerate computation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/movenc.c    | 3 +--
 tests/ref/fate/copy-psp | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer Oct. 9, 2016, 10:29 p.m. UTC | #1
On Sun, Oct 09, 2016 at 03:36:36AM +0200, Michael Niedermayer wrote:
> Using the stream timebase simply overflows
> Fix integer overflow in psp framerate computation
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/movenc.c    | 3 +--
>  tests/ref/fate/copy-psp | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)

applied

[...]
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8b4aa5f..2c155eb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4267,8 +4267,7 @@  static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
     AVCodecParameters *video_par = s->streams[0]->codecpar;
     AVCodecParameters *audio_par = s->streams[1]->codecpar;
     int audio_rate = audio_par->sample_rate;
-    // TODO: should be avg_frame_rate
-    int frame_rate = ((video_st->time_base.den) * (0x10000)) / (video_st->time_base.num);
+    int64_t frame_rate = (video_st->avg_frame_rate.num * 0x10000LL) / video_st->avg_frame_rate.den;
     int audio_kbitrate = audio_par->bit_rate / 1000;
     int video_kbitrate = FFMIN(video_par->bit_rate / 1000, 800 - audio_kbitrate);
 
diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp
index bc7e60d..7089f48 100644
--- a/tests/ref/fate/copy-psp
+++ b/tests/ref/fate/copy-psp
@@ -1,4 +1,4 @@ 
-c4b2503a069fecd2f82704decf285160 *tests/data/fate/copy-psp.psp
+6889223644fc560069c8591984175a62 *tests/data/fate/copy-psp.psp
 2041379 tests/data/fate/copy-psp.psp
 #extradata 0:       51, 0xaf6d1012
 #extradata 1:        2, 0x00b200a1