avformat/demux: Use r_frame_rate in compute_frame_duration if codec_framerate is unknown

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Nicolas Gaullier 2021-09-10 11:34:09 +02:00 committed by James Almer
parent fad459b5a6
commit daf04868d8

View File

@ -653,7 +653,7 @@ static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden,
*pden = 0;
switch (st->codecpar->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (st->r_frame_rate.num && !pc) {
if (st->r_frame_rate.num && (!pc || !codec_framerate.num)) {
*pnum = st->r_frame_rate.den;
*pden = st->r_frame_rate.num;
} else if (st->time_base.num * 1000LL > st->time_base.den) {