diff options
author | van <[email protected]> | 2008-09-05 06:16:44 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-09-05 06:16:44 +0000 |
commit | 52482a772acdb03a8b77d4d605f3c7678de20e11 (patch) | |
tree | 84f733fab14adfecc593a11696f83a1bc242275e | |
parent | 9b57e83b9ebf9bc5c774ab8280c93dd4049a8469 (diff) |
- get rid of another deadlock: if there were more than 64 audio frames before the first video frame we'd lock up the reader.
- if we get a bogus timestamp at the end of some conversion just ignore it and don't try to generate minutes or hours of silence to fill the hole.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1665 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/sync.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 524ca4d1b..0c359f1dd 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -188,14 +188,10 @@ int syncWork( hb_work_object_t * w, hb_buffer_t ** unused1, if ( pv->busy & 1 ) SyncVideo( w ); - /* If we ever got a video frame, handle audio now */ - if( pv->pts_offset != INT64_MIN ) + for( i = 0; i < hb_list_count( pv->job->title->list_audio ); i++ ) { - for( i = 0; i < hb_list_count( pv->job->title->list_audio ); i++ ) - { - if ( pv->busy & ( 1 << (i + 1) ) ) - SyncAudio( w, i ); - } + if ( pv->busy & ( 1 << (i + 1) ) ) + SyncAudio( w, i ); } return ( pv->busy? HB_WORK_OK : HB_WORK_DONE ); @@ -761,6 +757,19 @@ static void SyncAudio( hb_work_object_t * w, int i ) } if ( buf->start - sync->next_pts >= (90 * 70) ) { + if ( buf->start - sync->next_pts > (90000LL * 60) ) + { + // there's a gap of more than a minute between the last + // frame and this. assume we got a corrupted timestamp + // and just drop the next buf. + hb_log( "sync: %d minute time gap in audio %d - dropping buf" + " start %lld, next %lld", + (int)((buf->start - sync->next_pts) / (90000*60)), + i, buf->start, sync->next_pts ); + buf = hb_fifo_get( audio->priv.fifo_raw ); + hb_buffer_close( &buf ); + continue; + } /* * there's a gap of at least 70ms between the last * frame we processed & the next. Fill it with silence. |