lavf/demux: use avg_frame_rate for packet durations for notimestamps formats

avg_frame_rate, if set, should be more reliable than stream timebase in
this case.
pull/389/head
Anton Khirnov 2 years ago
parent a59b4ac713
commit e38e9f3d54
  1. 5
      libavformat/demux.c

@ -668,6 +668,11 @@ static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden,
if (st->r_frame_rate.num && (!pc || !codec_framerate.num)) {
*pnum = st->r_frame_rate.den;
*pden = st->r_frame_rate.num;
} else if ((s->iformat->flags & AVFMT_NOTIMESTAMPS) &&
!codec_framerate.num &&
st->avg_frame_rate.num && st->avg_frame_rate.den) {
*pnum = st->avg_frame_rate.den;
*pden = st->avg_frame_rate.num;
} else if (st->time_base.num * 1000LL > st->time_base.den) {
*pnum = st->time_base.num;
*pden = st->time_base.den;

Loading…
Cancel
Save