summaryrefslogtreecommitdiffstats
path: root/libhb/vfr.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-03-31 15:03:16 +0000
committerjstebbins <[email protected]>2012-03-31 15:03:16 +0000
commit57e4d1bcc1a8040562b2d248742ff74b34ca846a (patch)
treeb24bf501c52a127e61bffc77c1246d0055ea0aee /libhb/vfr.c
parentf8f1631a89c587600d6bfd82a01583afdde9f744 (diff)
libhb: fix cfr encoding
when frames are duplicated, the frame was not copied properly and resulted in divide by 0 later when the frame is processed. This fix is a bit larger than the minimum size necessary to fix the problem. I took the oportunity to clean up some buffer initialization and copy operations. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4563 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/vfr.c')
-rw-r--r--libhb/vfr.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c
index fb12393b9..7ea308124 100644
--- a/libhb/vfr.c
+++ b/libhb/vfr.c
@@ -277,9 +277,7 @@ static void adjust_frame_rate( hb_filter_private_t *pv, hb_buffer_t **buf_out )
for ( ; excess_dur >= pv->frame_rate; excess_dur -= pv->frame_rate )
{
/* next frame too far ahead - dup current frame */
- hb_buffer_t *dup = hb_buffer_init( out->size );
- memcpy( dup->data, out->data, out->size );
- dup->s = out->s;
+ hb_buffer_t *dup = hb_buffer_copy( out );
dup->s.new_chap = 0;
dup->s.start = cfr_stop;
cfr_stop += pv->frame_rate;