diff options
author | jstebbins <[email protected]> | 2012-04-10 18:31:48 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-04-10 18:31:48 +0000 |
commit | d0e3d7de3966ccbccd5bc90e95ac9e7e883602df (patch) | |
tree | 68d07d1315f6d0826b4d3efd8d47639d24d7956c /libhb/vfr.c | |
parent | 07a54cd602c6a1c5bdc2f43478e22cd211a1d62b (diff) |
libhb: fix a problem with start times of frames in CFR mode
some errors would allow gaps between frames and overlapping start times
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4585 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/vfr.c')
-rw-r--r-- | libhb/vfr.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c index 06b8f73ec..ab6666549 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -265,6 +265,7 @@ static void adjust_frame_rate( hb_filter_private_t *pv, hb_buffer_t **buf_out ) { out->s.stop = cfr_stop; } + pv->out_last_stop = out->s.stop; } else { @@ -274,6 +275,7 @@ static void adjust_frame_rate( hb_filter_private_t *pv, hb_buffer_t **buf_out ) // each of which is a frame time long. double excess_dur = (double)out->s.stop - cfr_stop; out->s.stop = cfr_stop; + pv->out_last_stop = out->s.stop; for ( ; excess_dur >= pv->frame_rate; excess_dur -= pv->frame_rate ) { /* next frame too far ahead - dup current frame */ @@ -282,12 +284,12 @@ static void adjust_frame_rate( hb_filter_private_t *pv, hb_buffer_t **buf_out ) dup->s.start = cfr_stop; cfr_stop += pv->frame_rate; dup->s.stop = cfr_stop; + pv->out_last_stop = dup->s.stop; out = insert_buffer_in_chain( out, dup ); ++pv->dups; ++pv->count_frames; } } - pv->out_last_stop = out->s.stop; } } @@ -486,10 +488,16 @@ static int hb_vfr_work( hb_filter_object_t * filter, { if( !head && !tail ) { - head = tail = next; + head = next; } else { tail->next = next; + } + // Move tail to the end of the list that + // adjust_frame_rate could return + while (next) + { tail = next; + next = next->next; } } } |