]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
rpl: Dont fill the index with entries that failed to be parsed
[ffmpeg] / libavformat / utils.c
index 6dc941bd1dc5b618dc64ad9e67990d9cafccae30..7f19abc5f17915662a9bc95a9a2172b30ee61e8f 100644 (file)
@@ -1079,7 +1079,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     // Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly.
     if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){
         av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts);
-        if(strcmp(s->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2")) // otherwise we discard correct timestamps for vc1-wmapro.ism
+        if (    strcmp(s->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2")
+             && strcmp(s->iformat->name, "flv")) // otherwise we discard correct timestamps for vc1-wmapro.ism
             pkt->dts= AV_NOPTS_VALUE;
     }
 
@@ -2730,6 +2731,7 @@ int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t ts)
             }
         }
         st->info->duration_count++;
+        st->info->rfps_duration_sum += duration;
 
         if (st->info->duration_count % 10 == 0) {
             int n = st->info->duration_count;
@@ -2783,6 +2785,10 @@ void ff_rfps_calculate(AVFormatContext *ic)
                     continue;
                 if(!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(j))
                     continue;
+
+                if (av_q2d(st->time_base) * st->info->rfps_duration_sum / st->info->duration_count < (1001*12.0 * 0.8)/get_std_framerate(j))
+                    continue;
+
                 for(k=0; k<2; k++){
                     int n= st->info->duration_count;
                     double a= st->info->duration_error[k][0][j] / n;
@@ -2804,6 +2810,7 @@ void ff_rfps_calculate(AVFormatContext *ic)
         av_freep(&st->info->duration_error);
         st->info->last_dts = AV_NOPTS_VALUE;
         st->info->duration_count = 0;
+        st->info->rfps_duration_sum = 0;
     }
 }