summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-12-15 02:36:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-12-15 02:36:03 +0000
commit90bb394dccacd10607153833a0aeba0d970dc8db (patch)
tree4ad5e35a1a16065b9579acdaeb943940480cf8d2
parent3c9ec07ef2f7a761bf0418b4d806b50ef57c41f3 (diff)
workaround some broken mpeg-ps timestamps
Originally committed as revision 3755 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c25ca08a2e..da5348644f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -741,6 +741,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
/* cannot compute PTS if not present (we can compute it only
by knowing the futur */
} else {
+ if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
+ int64_t old_diff= ABS(st->cur_dts - pkt->duration - pkt->pts);
+ int64_t new_diff= ABS(st->cur_dts - pkt->pts);
+ if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
+ pkt->pts += pkt->duration;
+ }
+ }
+
/* presentation is not delayed : PTS and DTS are the same */
if (pkt->pts == AV_NOPTS_VALUE) {
if (pkt->dts == AV_NOPTS_VALUE) {