changeset 2399:e1fdab28da80 libavformat

There is no guarantee that every stream will 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)
author michael
date Sat, 18 Aug 2007 00:45:44 +0000
parents 3306dae77205
children fcaecfb05781
files utils.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Sat Aug 18 00:44:14 2007 +0000
+++ b/utils.c	Sat Aug 18 00:45:44 2007 +0000
@@ -1551,7 +1551,8 @@
             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) {