aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-14 22:14:35 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-14 22:14:35 +0000
commit46911c7ab803607fd9285927ed23426a9d297723 (patch)
treef5e8105c8bd329e3d585c23aad72f6a47b476376 /libavformat
parentde34dc39c048a5e641f9d739d82a5281d00d7699 (diff)
downloadffmpeg-46911c7ab803607fd9285927ed23426a9d297723.tar.gz
use delay to avoid negative dts
Originally committed as revision 16604 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegtsenc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 0170a5acb8..82b8d88fb3 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -672,6 +672,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
MpegTSWriteStream *ts_st = st->priv_data;
int len, max_payload_size;
const uint8_t *access_unit_index = NULL;
+ const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
/* for subtitle, a single PES packet must be generated */
@@ -717,8 +718,8 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (access_unit_index && access_unit_index < buf &&
ts_st->payload_pts == AV_NOPTS_VALUE &&
ts_st->payload_dts == AV_NOPTS_VALUE) {
- ts_st->payload_dts = pkt->dts;
- ts_st->payload_pts = pkt->pts;
+ ts_st->payload_dts = pkt->dts + delay;
+ ts_st->payload_pts = pkt->pts + delay;
}
if (ts_st->payload_index >= max_payload_size) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,