From 9cac61c6debd505c7a4fb88c01d6dd2342896a8b Mon Sep 17 00:00:00 2001 From: van Date: Tue, 29 Jul 2008 18:50:28 +0000 Subject: [PATCH] Don't lose our existing buffer chain when nal_encode returns NULL. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1592 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/encx264.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/libhb/encx264.c b/libhb/encx264.c index ebd9f4bb5..f40903d9d 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -582,11 +582,14 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, break; hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal ); - if ( last_buf == NULL ) - *buf_out = buf; - else - last_buf->next = buf; - last_buf = buf; + if ( buf ) + { + if ( last_buf == NULL ) + *buf_out = buf; + else + last_buf->next = buf; + last_buf = buf; + } } // Flushed everything - add the eof to the end of the chain. if ( last_buf == NULL ) @@ -638,11 +641,14 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, new_stop = orig_stop; in->stop = new_stop; hb_buffer_t *buf = x264_encode( w, in ); - if ( last_buf == NULL ) - *buf_out = buf; - else - last_buf->next = buf; - last_buf = buf; + if ( buf ) + { + if ( last_buf == NULL ) + *buf_out = buf; + else + last_buf->next = buf; + last_buf = buf; + } in->start = new_stop; } } -- 2.40.0