OSDN Git Service

Don't lose our existing buffer chain when nal_encode returns NULL.
authorvan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 29 Jul 2008 18:50:28 +0000 (18:50 +0000)
committervan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 29 Jul 2008 18:50:28 +0000 (18:50 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@1592 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/encx264.c

index ebd9f4b..f40903d 100644 (file)
@@ -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;
         }
     }