# HG changeset patch # User michael # Date 1219974207 0 # Node ID 6a1d266be2fc52faef07a795c93844363bcd084f # Parent a8a70ae1920636c4b9a1d007a80a45df042a7c89 Do not truncate timestamps before the muxer as it makes simple things like last_pts - pts rather tricky and is not good for anything. Timestamps should be truncated just before storing when needed. diff -r a8a70ae19206 -r 6a1d266be2fc utils.c --- a/utils.c Thu Aug 28 22:41:00 2008 +0000 +++ b/utils.c Fri Aug 29 01:43:27 2008 +0000 @@ -2574,18 +2574,6 @@ return 0; } -static void truncate_ts(AVStream *st, AVPacket *pkt){ - int64_t pts_mask = (2LL << (st->pts_wrap_bits-1)) - 1; - -// if(pkt->dts < 0) -// pkt->dts= 0; //this happens for low_delay=0 and B-frames, FIXME, needs further investigation about what we should do here - - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts &= pts_mask; - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts &= pts_mask; -} - int av_write_frame(AVFormatContext *s, AVPacket *pkt) { int ret = compute_pkt_fields2(s->streams[pkt->stream_index], pkt); @@ -2593,8 +2581,6 @@ if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return ret; - truncate_ts(s->streams[pkt->stream_index], pkt); - ret= s->oformat->write_packet(s, pkt); if(!ret) ret= url_ferror(s->pb); @@ -2690,7 +2676,6 @@ if(ret<=0) //FIXME cleanup needed for ret<0 ? return ret; - truncate_ts(s->streams[opkt.stream_index], &opkt); ret= s->oformat->write_packet(s, &opkt); av_free_packet(&opkt); @@ -2715,7 +2700,6 @@ if(!ret) break; - truncate_ts(s->streams[pkt.stream_index], &pkt); ret= s->oformat->write_packet(s, &pkt); av_free_packet(&pkt);