summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-09-11 09:45:21 +0000
committerjstebbins <[email protected]>2012-09-11 09:45:21 +0000
commit16d4d5215502aa3b621013223beb8235469b677e (patch)
tree7b317ab405bb661f09190ee9e63fc703c79a6bfa
parent720a8bb4ad4eb4eee2ce7d145448b4c3f120b482 (diff)
libhb: handle overlapping timestamps better
This shouldn't happen except in the case of bad sources or an hb bug. But if encountered, it provoked a feedback loop of frame dropping and duplication where there should have been a single frame drop. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4952 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/vfr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c
index 8bd731b74..8e50d5b89 100644
--- a/libhb/vfr.c
+++ b/libhb/vfr.c
@@ -539,6 +539,14 @@ static int hb_vfr_work( hb_filter_object_t * filter,
pv->total_lost_time += temp_duration;
}
+ else if ( in->s.stop <= pv->last_stop[0] )
+ {
+ // This is generally an error somewhere (bad source or hb bug).
+ // But lets do our best to straighten out the mess.
+ ++pv->drops;
+ hb_buffer_close(&in);
+ return HB_FILTER_OK;
+ }
/* Cache frame start and stop times, so we can renumber
time stamps if dropping frames for VFR. */