summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-01-27 19:37:52 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-01-27 19:37:52 +0000
commitd30a8beb99caad9738fc17ca36ad19b545c911c4 (patch)
tree2c22b62ae78ff988f0e7ee9c5b792c3767cd7a6a
parentad5cc780c0b29f0821efbb39e57e2b43f25d8793 (diff)
Fix duration calculation in the presence of a single wraping of the timeline.
Fixes issue1714. Originally committed as revision 21485 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 64c5ec492b..c15b5f1cf0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1823,6 +1823,8 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
start_time[pkt->stream_index] != AV_NOPTS_VALUE) {
end_time = pkt->pts;
duration = end_time - start_time[pkt->stream_index];
+ if (duration < 0)
+ duration += 1LL<<st->pts_wrap_bits;
if (duration > 0) {
if (st->duration == AV_NOPTS_VALUE ||
st->duration < duration)