av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
best_fps, 12 * 1001, INT_MAX);
}
+
+#ifdef __TIZEN__ //code from ffmpeg 6.0 to fix wrong fps.
+ if (!st->r_frame_rate.num) {
+ AVRational time_base = avctx->framerate.num ? av_inv_q(av_mul_q(avctx->framerate,
+ (AVRational){avctx->ticks_per_frame, 1}))
+ /* NOHEADER check added to not break existing behavior */
+ : ((ic->ctx_flags & AVFMTCTX_NOHEADER) ? (AVRational){0, 1}
+ : st->time_base);
+ if ( time_base.den * (int64_t) st->time_base.num
+ <= time_base.num * (uint64_t)avctx->ticks_per_frame * st->time_base.den) {
+ av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
+ time_base.den, (int64_t)time_base.num * avctx->ticks_per_frame, INT_MAX);
+ } else {
+ st->r_frame_rate.num = st->time_base.den;
+ st->r_frame_rate.den = st->time_base.num;
+ }
+ }
+#else
if (!st->r_frame_rate.num) {
const AVCodecDescriptor *desc = sti->codec_desc;
AVRational mul = (AVRational){ desc && (desc->props & AV_CODEC_PROP_FIELDS) ? 2 : 1, 1 };
st->r_frame_rate.den = st->time_base.num;
}
}
+#endif
st->codecpar->framerate = avctx->framerate;
if (sti->display_aspect_ratio.num && sti->display_aspect_ratio.den) {
AVRational hw_ratio = { avctx->height, avctx->width };