summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-19 12:29:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-19 12:38:29 +0100
commit00ad3432e1d80ef73cd9aea3c3b5028aeaad84b6 (patch)
tree3ae4a32204938cb18791346a61f9d0eb2c0137ec
parent09585e377c71bb1a153717350011e062ae089385 (diff)
parentb81b0cc22b22413760423e239ea644c9afdbfa2d (diff)
Merge commit 'b81b0cc22b22413760423e239ea644c9afdbfa2d'
* commit 'b81b0cc22b22413760423e239ea644c9afdbfa2d': movenc: Set the last packet duration based on the next packet when autoflushing Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/movenc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index cf37c02d3f..3477ae0944 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4536,8 +4536,14 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
(mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME &&
enc->codec_type == AVMEDIA_TYPE_VIDEO &&
trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) {
- if (frag_duration >= mov->min_fragment_duration)
+ if (frag_duration >= mov->min_fragment_duration) {
+ // Set the duration of this track to line up with the next
+ // sample in this track. This avoids relying on AVPacket
+ // duration, but only helps for this particular track, not
+ // for the other ones that are flushed at the same time.
+ trk->track_duration = pkt->dts - trk->start_dts;
mov_auto_flush_fragment(s);
+ }
}
return ff_mov_write_packet(s, pkt);