[FFmpeg-cvslog] r25393 - trunk/libavformat/utils.c

aurel subversion
Thu Oct 7 21:05:32 CEST 2010


Author: aurel
Date: Thu Oct  7 21:05:31 2010
New Revision: 25393

Log:
remove useless local allocated start_time array

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Thu Oct  7 13:18:16 2010	(r25392)
+++ trunk/libavformat/utils.c	Thu Oct  7 21:05:31 2010	(r25393)
@@ -1883,14 +1883,10 @@ static void av_estimate_timings_from_pts
     AVPacket pkt1, *pkt = &pkt1;
     AVStream *st;
     int read_size, i, ret;
-    int64_t end_time, *start_time;
+    int64_t end_time;
     int64_t filesize, offset, duration;
     int retry=0;
 
-    if (nb_streams >= INT_MAX/sizeof(*start_time) ||
-        !(start_time = av_malloc(nb_streams * sizeof(*start_time))))
-        return;
-
     ic->cur_st = NULL;
 
     /* flush packet queue */
@@ -1898,11 +1894,7 @@ static void av_estimate_timings_from_pts
 
     for (i=0; i<nb_streams; i++) {
         st = ic->streams[i];
-        if(st->start_time != AV_NOPTS_VALUE){
-            start_time[i]= st->start_time;
-        }else if(st->first_dts != AV_NOPTS_VALUE){
-            start_time[i]= st->first_dts;
-        }else
+        if (st->start_time == AV_NOPTS_VALUE && st->first_dts == AV_NOPTS_VALUE)
             av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n");
 
         if (st->parser) {
@@ -1935,9 +1927,11 @@ static void av_estimate_timings_from_pts
         read_size += pkt->size;
         st = ic->streams[pkt->stream_index];
         if (pkt->pts != AV_NOPTS_VALUE &&
-            start_time[pkt->stream_index] != AV_NOPTS_VALUE) {
-            end_time = pkt->pts;
-            duration = end_time - start_time[pkt->stream_index];
+            (st->start_time != AV_NOPTS_VALUE ||
+             st->first_dts  != AV_NOPTS_VALUE)) {
+            duration = end_time = pkt->pts;
+            if (st->start_time != AV_NOPTS_VALUE)  duration -= st->start_time;
+            else                                   duration -= st->first_dts;
             if (duration < 0)
                 duration += 1LL<<st->pts_wrap_bits;
             if (duration > 0) {
@@ -1951,7 +1945,6 @@ static void av_estimate_timings_from_pts
     }while(   end_time==AV_NOPTS_VALUE
            && filesize > (DURATION_MAX_READ_SIZE<<retry)
            && ++retry <= DURATION_MAX_RETRY);
-    av_free(start_time);
 
     fill_all_stream_timings(ic);
 



More information about the ffmpeg-cvslog mailing list