]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
move max analyze duration check before considering new packet
authorbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 19 Mar 2009 21:54:34 +0000 (21:54 +0000)
committerbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 19 Mar 2009 21:54:34 +0000 (21:54 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18051 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/utils.c

index 7419cc662573456e3b44ad510c8cf957fc9569b7..18ca13e5e49b811be1eae5fe56b125259117a4cf 100644 (file)
@@ -2137,8 +2137,11 @@ int av_find_stream_info(AVFormatContext *ic)
         read_size += pkt->size;
 
         st = ic->streams[pkt->stream_index];
-        if(codec_info_nb_frames[st->index]>1)
+        if(codec_info_nb_frames[st->index]>1) {
+            if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration)
+                break;
             codec_info_duration[st->index] += pkt->duration;
+        }
         if (pkt->duration != 0)
             codec_info_nb_frames[st->index]++;
 
@@ -2199,9 +2202,6 @@ int av_find_stream_info(AVFormatContext *ic)
              (st->codec->codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
             try_decode_frame(st, pkt->data, pkt->size);
 
-        if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
-            break;
-        }
         count++;
     }