diff options
author | jstebbins <[email protected]> | 2013-06-16 16:16:52 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2013-06-16 16:16:52 +0000 |
commit | a7c727258d956a3a54e8b051d0b4838e56632685 (patch) | |
tree | 21cd3160a42dcf7f6079bf4ec5abfb1527bb9fa8 /libhb/sync.c | |
parent | 9c4ba8930b22f92f0d8b985eb77a96fca4a62d28 (diff) |
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
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 8 |
1 files changed, 4 insertions, 4 deletions
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. |