From da80bb8d441e3c12260f2f1bc0fff218112cb42d Mon Sep 17 00:00:00 2001 From: van Date: Mon, 30 Jun 2008 04:32:49 +0000 Subject: If we always require a buffer to be available on every fifo we'll eventually deadlock since video and audio run at different rates. Instead take the earliest available buffer (so we don't starve any of the fifos) but don't lock up if fifos are occasionally empty. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1542 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/muxcommon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libhb') diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index 04e876a44..13a899224 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -40,7 +40,11 @@ static hb_track_t * GetTrack( hb_list_t * list ) buf = hb_fifo_see( track2->fifo ); if( !buf ) { - return NULL; + // To make sure we don't camp on one fifo & prevent the others + // from making progress we take the earliest data of all the + // data that's currently available but we don't care if some + // fifos don't have data. + continue; } if( !track || buf->start < pts ) { @@ -142,10 +146,8 @@ static void MuxerFunc( void * _mux ) if( !( track = GetTrack( list ) ) ) { hb_snooze( thread_sleep_interval ); -// thread_sleep_interval += 1; continue; } -// thread_sleep_interval = MAX(1, (thread_sleep_interval - 1)); buf = hb_fifo_get( track->fifo ); if( job->pass == 0 || job->pass == 2 ) -- cgit v1.2.3