OSDN Git Service

fix a segfault and a deadlock if reader exits befor first buffer sent
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 29 Oct 2010 16:17:48 +0000 (16:17 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 29 Oct 2010 16:17:48 +0000 (16:17 +0000)
This can happen if enough of the source is good that it scans but the
beginning has an error that causes reader to exit.

git-svn-id: svn://localhost/HandBrake/trunk@3628 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/decavcodec.c
libhb/sync.c

index cff6e43..e461f63 100644 (file)
@@ -1014,7 +1014,10 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
     /* if we got an empty buffer signaling end-of-stream send it downstream */
     if ( in->size == 0 )
     {
-        decodeVideo( pv, in->data, in->size, in->sequence, pts, dts );
+        if ( pv->context->codec != NULL )
+        {
+            decodeVideo( pv, in->data, in->size, in->sequence, pts, dts );
+        }
         hb_list_add( pv->list, in );
         *buf_out = link_buf_list( pv );
         return HB_WORK_DONE;
index acc782e..57809d7 100644 (file)
@@ -327,7 +327,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
     }
 
     /* Wait till we can determine the initial pts of all streams */
-    if( pv->common->pts_offset == INT64_MIN )
+    if( next->size != 0 && pv->common->pts_offset == INT64_MIN )
     {
         pv->common->first_pts[0] = next->start;
         hb_lock( pv->common->mutex );