diff options
author | van <[email protected]> | 2008-07-08 20:34:06 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-07-08 20:34:06 +0000 |
commit | 6558d950cf635d1c01bca8b34f048960b8821dcf (patch) | |
tree | cef3caca07829e0c0a97ecff7a5270a021e9bc23 | |
parent | e102ca7f6cfd706c1f153b2ea7ec6b2f58ba1720 (diff) |
Fix mkv A/V sync problem created by R1542.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1559 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/muxcommon.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index 13a899224..b3337b7bb 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -27,7 +27,7 @@ typedef struct } hb_track_t; -static hb_track_t * GetTrack( hb_list_t * list ) +static hb_track_t * GetTrack( hb_list_t * list, hb_job_t *job ) { hb_buffer_t * buf; hb_track_t * track = NULL, * track2; @@ -40,6 +40,18 @@ static hb_track_t * GetTrack( hb_list_t * list ) buf = hb_fifo_see( track2->fifo ); if( !buf ) { + // XXX libmkv uses a very simple minded muxer that will fail if the + // audio & video are out of sync. To keep them in sync we require + // that *all* fifos have a buffer then we take the oldest. + // Unfortunately this means we can hang in a deadlock with the + // reader process filling the fifos. With the current libmkv + // there's no way to avoid occasional deadlocks & we can only + // suggest that users evolve to using mp4s. + if ( job->mux == HB_MUX_MKV ) + { + 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 @@ -143,7 +155,7 @@ static void MuxerFunc( void * _mux ) int thread_sleep_interval = 50; while( !*job->die && !job->done ) { - if( !( track = GetTrack( list ) ) ) + if( !( track = GetTrack( list, job ) ) ) { hb_snooze( thread_sleep_interval ); continue; |