diff options
author | van <[email protected]> | 2009-09-21 07:18:49 +0000 |
---|---|---|
committer | van <[email protected]> | 2009-09-21 07:18:49 +0000 |
commit | 1ab19c13e332432230ef443483c65135a22d3e00 (patch) | |
tree | 1d13bfaba8ce22ea45afa444efd38cb8d529824b | |
parent | d94b403a57815095142e1c495fccc938df5e11e7 (diff) |
Fix bug that was causing one sec. of audio to be dropped on many ffmpeg files. Problem is that audio & video can be interleaved in any order but we drop everything up to the first video frame. Since ffmpeg returns a second of audio per read on an audio stream, if audio started before video we lose the first second of it. Changed to allow either audio or video to signal start 'reader'.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2831 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/reader.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libhb/reader.c b/libhb/reader.c index 88617f90b..11cb23b6f 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -333,17 +333,22 @@ static void ReaderFunc( void * _r ) hb_list_rem( list, buf ); fifos = GetFifoForId( r->job, buf->id ); - if ( ! r->saw_video ) + if ( fifos && ! r->saw_video ) { - /* The first video packet defines 'time zero' so discard - data until we get a video packet with a PTS & DTS */ - if ( buf->id == r->title->video_id && buf->start != -1 && - buf->renderOffset != -1 ) + // The first data packet with a PTS from an audio or video stream + // that we're decoding defines 'time zero'. Discard packets until + // we get one. + if ( buf->start != -1 && buf->renderOffset != -1 && + ( buf->id == r->title->video_id || is_audio( r, buf->id ) ) ) { // force a new scr offset computation r->scr_changes = r->demux.scr_changes - 1; + // create a stream state if we don't have one so the + // offset will get computed correctly. + id_to_st( r, buf ); r->saw_video = 1; - hb_log( "reader: first SCR %"PRId64, r->demux.last_scr ); + hb_log( "reader: first SCR %"PRId64" id %d DTS %"PRId64, + r->demux.last_scr, buf->id, buf->renderOffset ); } else { |