Commit 0e5f33f2 authored by Michael Niedermayer's avatar Michael Niedermayer

Make sure a set r_frame_rate is not overriden by a guess.

Also make sure we dont waste time in this case with collecting timestamps.

Originally committed as revision 21957 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent f51674ff
...@@ -2120,7 +2120,7 @@ int av_find_stream_info(AVFormatContext *ic) ...@@ -2120,7 +2120,7 @@ int av_find_stream_info(AVFormatContext *ic)
if (!has_codec_parameters(st->codec)) if (!has_codec_parameters(st->codec))
break; break;
/* variable fps and no guess at the real fps */ /* variable fps and no guess at the real fps */
if( tb_unreliable(st->codec) if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num)
&& duration_count[i]<20 && st->codec->codec_type == CODEC_TYPE_VIDEO) && duration_count[i]<20 && st->codec->codec_type == CODEC_TYPE_VIDEO)
break; break;
if(st->parser && st->parser->parser->split && !st->codec->extradata) if(st->parser && st->parser->parser->split && !st->codec->extradata)
...@@ -2251,9 +2251,9 @@ int av_find_stream_info(AVFormatContext *ic) ...@@ -2251,9 +2251,9 @@ int av_find_stream_info(AVFormatContext *ic)
// the check for tb_unreliable() is not completely correct, since this is not about handling // the check for tb_unreliable() is not completely correct, since this is not about handling
// a unreliable/inexact time base, but a time base that is finer than necessary, as e.g. // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
// ipmovie.c produces. // ipmovie.c produces.
if (tb_unreliable(st->codec) && duration_count[i] > 15 && duration_gcd[i] > 1) if (tb_unreliable(st->codec) && duration_count[i] > 15 && duration_gcd[i] > 1 && !st->r_frame_rate.num)
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * duration_gcd[i], INT_MAX); av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * duration_gcd[i], INT_MAX);
if(duration_count[i] if(duration_count[i] && !st->r_frame_rate.num
&& tb_unreliable(st->codec) /*&& && tb_unreliable(st->codec) /*&&
//FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ... //FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ...
st->time_base.num*duration_sum[i]/duration_count[i]*101LL > st->time_base.den*/){ st->time_base.num*duration_sum[i]/duration_count[i]*101LL > st->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