summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-28 15:40:23 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-28 15:49:51 +0200
commit1f249d2ca725c9ac06887116638b16be6b15f7dd (patch)
tree613df87638d07e020f9d809103a389a93db1c458 /libavformat/utils.c
parent4394f82f52583dc1d781d29dcb3f2a8dac73f3f6 (diff)
avformat/utils: prevent r frame rate from being set larger than 1/tb
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a5310383c8..09c85a2e5f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2993,6 +2993,7 @@ void ff_rfps_calculate(AVFormatContext *ic)
&& tb_unreliable(st->codec)) {
int num = 0;
double best_error= 0.01;
+ AVRational ref_rate = st->r_frame_rate.num ? st->r_frame_rate : av_inv_q(st->time_base);
for (j= 0; j<MAX_STD_TIMEBASES; j++) {
int k;
@@ -3019,7 +3020,7 @@ void ff_rfps_calculate(AVFormatContext *ic)
}
}
// do not increase frame rate by more than 1 % in order to match a standard rate.
- if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate)))
+ if (num && (!ref_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(ref_rate)))
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
}