diff options
author | Martin Storsjö <martin@martin.st> | 2015-03-15 23:40:06 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2015-03-19 10:27:15 +0200 |
commit | eee13d653953083553cceadbbedf6222ef78a006 (patch) | |
tree | bcc02948890ebe52b0afafa459d4a9daeac04efa /libavformat | |
parent | 5cf892d6946b19a87bcd00d6b76ce81f45960fdb (diff) | |
download | ffmpeg-eee13d653953083553cceadbbedf6222ef78a006.tar.gz |
movenc: Only adjust the cts offset at the start of fragments if necessary
Adjusting it is only necessary when a sidx/tfrf/tfxd atom already has
been written for the previous fragment (since the sidx/tfrf/tfxd atoms
include the duration between the first pts of the previous fragment, to
the first pts of the new fragment).
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/movenc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bc5370ee79..85d865e28d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3454,10 +3454,12 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) * of this packet to be what the previous packets duration implies. */ trk->cluster[trk->entry].dts = trk->start_dts + trk->track_duration; /* We also may have written the pts and the corresponding duration - * in sidx tags; make sure the sidx pts and duration match up with + * in sidx/tfrf/tfxd tags; make sure the sidx pts and duration match up with * the next fragment. This means the cts of the first sample must * be the same in all fragments. */ - pkt->pts = pkt->dts + trk->start_cts; + if ((mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_FASTSTART)) || + mov->mode == MODE_ISM) + pkt->pts = pkt->dts + trk->start_cts; } else { /* New fragment, but discontinuous from previous fragments. * Pretend the duration sum of the earlier fragments is |