diff options
author | van <[email protected]> | 2008-06-30 04:32:49 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-06-30 04:32:49 +0000 |
commit | da80bb8d441e3c12260f2f1bc0fff218112cb42d (patch) | |
tree | 24368d205399e879475ca3acb5fda0847ed037ef /libhb | |
parent | 45ce65f74863a7ee8d3ccf8978608794f2c91f42 (diff) |
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
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/muxcommon.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 ) |