aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/segment.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2014-07-17 14:49:20 +0200
committerStefano Sabatini <stefasab@gmail.com>2014-07-17 16:51:50 +0200
commit5acad50056f653672a0e9b6b2986089c32046afb (patch)
tree930af9f73a3370e19eb183b13f6271411c0e0094 /libavformat/segment.c
parent88f038ac97a875f25c2eceac6d2107a09314984c (diff)
downloadffmpeg-5acad50056f653672a0e9b6b2986089c32046afb.tar.gz
lavf/segment: only use reference frames for computing the segment end time
This avoids a systematic overestimate of the segments duration when there are several streams. Fix trac ticket #3724.
Diffstat (limited to 'libavformat/segment.c')
-rw-r--r--libavformat/segment.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 3de462326a..7c3a3c5f30 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -728,7 +728,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
seg->cur_entry.index = seg->segment_idx + seg->segment_idx_wrap*seg->segment_idx_wrap_nb;
seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base);
seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q);
- } else if (pkt->pts != AV_NOPTS_VALUE) {
+ } else if (pkt->pts != AV_NOPTS_VALUE && pkt->stream_index == seg->reference_stream_index) {
seg->cur_entry.end_time =
FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + pkt->duration) * av_q2d(st->time_base));
}