1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

workaround some broken mpeg-ps timestamps

Originally committed as revision 3755 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2004-12-15 02:36:03 +00:00
parent 3c9ec07ef2
commit 90bb394dcc

View File

@ -741,6 +741,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
/* cannot compute PTS if not present (we can compute it only /* cannot compute PTS if not present (we can compute it only
by knowing the futur */ by knowing the futur */
} else { } 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 */ /* presentation is not delayed : PTS and DTS are the same */
if (pkt->pts == AV_NOPTS_VALUE) { if (pkt->pts == AV_NOPTS_VALUE) {
if (pkt->dts == AV_NOPTS_VALUE) { if (pkt->dts == AV_NOPTS_VALUE) {