# HG changeset patch # User michael # Date 1103078163 0 # Node ID 65787cd808e4cbf49919834059e82f6f2aa99b3b # Parent 1ca4877e42f32f0b6dd610c66780a7a1205822b4 workaround some broken mpeg-ps timestamps diff -r 1ca4877e42f3 -r 65787cd808e4 utils.c --- a/utils.c Tue Dec 14 16:19:26 2004 +0000 +++ b/utils.c Wed Dec 15 02:36:03 2004 +0000 @@ -741,6 +741,14 @@ /* 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) {