changeset 5703:07214788e1e1 libavformat

Count all frames with codec_info_nb_frames not just ones with non zero duration. I hope this breaks nothing. Its needed for my fix of issue1156
author michael
date Tue, 23 Feb 2010 16:29:57 +0000
parents c9466f118684
children 6b9c2a6d8fa4
files utils.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Tue Feb 23 15:07:18 2010 +0000
+++ b/utils.c	Tue Feb 23 16:29:57 2010 +0000
@@ -2184,7 +2184,6 @@
             }
             codec_info_duration[st->index] += pkt->duration;
         }
-        if (pkt->duration != 0)
             st->codec_info_nb_frames++;
 
         {
@@ -2241,7 +2240,7 @@
     }
     for(i=0;i<ic->nb_streams;i++) {
         st = ic->streams[i];
-        if(st->codec_info_nb_frames>2 && !st->avg_frame_rate.num)
+        if(st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && codec_info_duration[i])
             av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
                      (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
                       codec_info_duration[i]    *(int64_t)st->time_base.num, 60000);