Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2011-09-07 19:17:51 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2011-09-07 19:17:51 +0400
commitb9f7e59f916923f6e8af8e05855fed4424aced69 (patch)
tree123ce96898da4c1b7cae4d6af39db3bf454fd87c
parent1472d8afe90d0446f72b7335bf80c24bece10d61 (diff)
mpeg: improve handling of wrapped/broken timestamps at eoflav0.35
-rw-r--r--libavformat/utils.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e490f0428a..6e423b8fa6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1991,6 +1991,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
int64_t end_time;
int64_t filesize, offset, duration;
int retry=0;
+ int wrapped=0;
ic->cur_st = NULL;
@@ -2039,8 +2040,12 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
duration -= st->start_time;
else
duration -= st->first_dts;
- if (duration < 0)
+ /* check if the duration might have wrapped around
+ only accept at the first timestamp, or when we saw wraps elsewhere */
+ if (duration < 0 && (st->duration == AV_NOPTS_VALUE || wrapped)) {
duration += 1LL<<st->pts_wrap_bits;
+ wrapped = 1;
+ }
if (duration > 0) {
if (st->duration == AV_NOPTS_VALUE || st->duration < duration)
st->duration = duration;