From 3443f6af431934efffdf22ffacc04b7f7ed4b375 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 9 Dec 2015 13:06:33 -0800 Subject: [PATCH] reader: fix stream discontinuity splicing... Splicing of buffers that got duplicated to multiple output fifos was broken. Caused https://forum.handbrake.fr/viewtopic.php?f=11&t=33666 --- libhb/reader.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libhb/reader.c b/libhb/reader.c index 8d32dc31c..009f3ec41 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -331,7 +331,7 @@ static void reader_close( hb_work_object_t * w ) free( r ); } -static void push_buf( hb_work_private_t *r, hb_fifo_t *fifo, hb_buffer_t *buf ) +static hb_buffer_t * splice_discontinuity( hb_work_private_t *r, hb_buffer_t *buf ) { // Handle buffers that were split across a PCR discontinuity. // Rejoin them into a single buffer. @@ -341,7 +341,7 @@ static void push_buf( hb_work_private_t *r, hb_fifo_t *fifo, hb_buffer_t *buf ) hb_buffer_list_append(list, buf); if (buf->s.split) { - return; + return NULL; } int count = hb_buffer_list_count(list); @@ -366,6 +366,11 @@ static void push_buf( hb_work_private_t *r, hb_fifo_t *fifo, hb_buffer_t *buf ) buf = hb_buffer_list_clear(list); } } + return buf; +} + +static void push_buf( hb_work_private_t *r, hb_fifo_t *fifo, hb_buffer_t *buf ) +{ while ( !*r->die && !r->job->done ) { if ( hb_fifo_full_wait( fifo ) ) @@ -770,7 +775,8 @@ static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, } #endif } - if( fifos ) + buf = splice_discontinuity(r, buf); + if( fifos && buf != NULL ) { if ( !r->start_found ) { -- 2.40.0