Commit 20922325 authored by Anton Khirnov's avatar Anton Khirnov

lavf: estimate frame duration from r_frame_rate.

If r_frame_rate is set, it should be more reliable for this than either
codec or stream timebase.
parent 91b412e7
...@@ -826,7 +826,10 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st, ...@@ -826,7 +826,10 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
*pden = 0; *pden = 0;
switch(st->codec->codec_type) { switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
if(st->time_base.num*1000LL > st->time_base.den){ if (st->r_frame_rate.num) {
*pnum = st->r_frame_rate.den;
*pden = st->r_frame_rate.num;
} else if(st->time_base.num*1000LL > st->time_base.den) {
*pnum = st->time_base.num; *pnum = st->time_base.num;
*pden = st->time_base.den; *pden = st->time_base.den;
}else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){ }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){
......
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