From: jstebbins Date: Sun, 16 Jun 2013 16:16:52 +0000 (+0000) Subject: libhb: fix hang that can occur under certain error conditions X-Git-Tag: 0.10.0~855 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7c727258d956a3a54e8b051d0b4838e56632685;p=handbrake libhb: fix hang that can occur under certain error conditions audio and video sync are in wait loops when they first start. if an error happens during this period, the hang would happen. check w->done in these loops to break out in case of error. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5592 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/libhb/sync.c b/libhb/sync.c index 3e88c40e5..a5158f738 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -273,7 +273,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in, { pv->common->first_pts[0] = next->s.start; hb_lock( pv->common->mutex ); - while( pv->common->pts_offset == INT64_MIN ) + while( pv->common->pts_offset == INT64_MIN && !*w->done ) { // Full fifos will make us wait forever, so get the // pts offset from the available streams if full @@ -741,7 +741,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, { pv->common->first_pts[sync->index+1] = buf->s.start; hb_lock( pv->common->mutex ); - while( pv->common->pts_offset == INT64_MIN ) + while( pv->common->pts_offset == INT64_MIN && !*w->done) { // Full fifos will make us wait forever, so get the // pts offset from the available streams if full @@ -761,7 +761,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, /* Wait for start frame if doing point-to-point */ hb_lock( pv->common->mutex ); start = buf->s.start - pv->common->audio_pts_slip; - while ( !pv->common->start_found ) + while ( !pv->common->start_found && !*w->done ) { if ( pv->common->audio_pts_thresh < 0 ) { @@ -777,7 +777,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in, return HB_WORK_OK; } while ( !pv->common->start_found && - buf->s.start >= pv->common->audio_pts_thresh ) + buf->s.start >= pv->common->audio_pts_thresh && !*w->done ) { hb_cond_timedwait( pv->common->next_frame, pv->common->mutex, 10 ); // There is an unfortunate unavoidable deadlock that can occur.