Warn user about invalid timestamps.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 23 May 2008 17:52:42 +0000 (17:52 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 23 May 2008 17:52:42 +0000 (17:52 +0000)
Originally committed as revision 13264 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index 73c28e72ab88723f78b4b938ffa34f40c487f7ff..e37577dbd7bcd3a47a14c12cd87de1a9208c127b 100644 (file)
@@ -850,6 +850,18 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
                 return ret;
             }
 
                 return ret;
             }
 
+            if(s->cur_pkt.pts != AV_NOPTS_VALUE &&
+               s->cur_pkt.dts != AV_NOPTS_VALUE &&
+               s->cur_pkt.pts < s->cur_pkt.dts){
+                av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
+                    s->cur_pkt.stream_index,
+                    s->cur_pkt.pts,
+                    s->cur_pkt.dts,
+                    s->cur_pkt.size);
+//                av_free_packet(&s->cur_pkt);
+//                return -1;
+            }
+
             st = s->streams[s->cur_pkt.stream_index];
             if(st->codec->debug & FF_DEBUG_PTS)
                 av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
             st = s->streams[s->cur_pkt.stream_index];
             if(st->codec->debug & FF_DEBUG_PTS)
                 av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",