Commit 1f249d2c authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/utils: prevent r frame rate from being set larger than 1/tb

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4394f82f
......@@ -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);
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment