diff options
author | jstebbins <[email protected]> | 2013-08-26 21:27:39 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2013-08-26 21:27:39 +0000 |
commit | ec915d89da5cebf5f30b9c8e909a1233d105a14d (patch) | |
tree | dc525cff454b37c29144d1c1dfd6fbca2081de6d /libhb/decpgssub.c | |
parent | 620263207a75aa83aa417c08a55f8906af6f3685 (diff) |
libhb: fix potential pgs timestamp problem
Under rare circumstances, the computed start time would jump backward.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5753 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decpgssub.c')
-rw-r--r-- | libhb/decpgssub.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c index 3c6c8fe90..f6004cb6d 100644 --- a/libhb/decpgssub.c +++ b/libhb/decpgssub.c @@ -282,12 +282,31 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in, // work around broken timestamps if (pts < 0 && in->s.start >= 0) { - pts = in->s.start; + if (pts < pv->last_pts) + { + // XXX: this should only happen if the prevous pts + // was unknown and our 3 second default duration + // overshot the next pgs pts. + // + // assign a 1 second duration + pts = pv->last_pts + 1 * 90000LL; + hb_log("[warning] decpgssub: track %d, non-monotically increasing PTS", + w->subtitle->out_track); + } + else + { + pts = in->s.start; + } } else if (pts < 0) { // XXX: a broken pts will cause us to drop this subtitle, // which is bad; use a default duration of 3 seconds + // + // A broken pts is only generated when a pgs packet + // occurs after a discontinuity and before the + // next audio or video packet which re-establishes + // timing (afaik). pts = pv->last_pts + 3 * 90000LL; hb_log("[warning] decpgssub: track %d, invalid PTS", w->subtitle->out_track); |