There is no guarantee that every stream will
authorNeil Brown <neilb@suse.de>
Sat, 18 Aug 2007 00:45:44 +0000 (00:45 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 18 Aug 2007 00:45:44 +0000 (00:45 +0000)
have a start_time found (though it is likely),
so check that the start_time is defined before
calculating a duration.
 (patch by neilb suse de)

Originally committed as revision 10138 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index 9663a99..0eba3e6 100644 (file)
@@ -1551,7 +1551,8 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
             break;
         read_size += pkt->size;
         st = ic->streams[pkt->stream_index];
-        if (pkt->pts != AV_NOPTS_VALUE) {
+        if (pkt->pts != AV_NOPTS_VALUE &&
+            st->start_time != AV_NOPTS_VALUE) {
             end_time = pkt->pts;
             duration = end_time - st->start_time;
             if (duration > 0) {