X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=libhb%2Fsync.c;h=0c359f1dda7c2f41b218a56f2533ea3d48c80900;hb=533776bbad20db93fe964bc69975f108b2a30888;hp=09ef0d9a27317cf4cca8dd2a4a210777481965ba;hpb=22ebae2b03cfd2b31d470fe7e86e5c86d97e59d4;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/sync.c b/libhb/sync.c index 09ef0d9a..0c359f1d 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -111,10 +111,13 @@ int syncInit( hb_work_object_t * w, hb_job_t * job ) pv->busy |= 1; /* Initialize libsamplerate for every audio track we have */ - for( i = 0; i < hb_list_count( title->list_audio ); i++ ) + if ( ! job->indepth_scan ) { - pv->busy |= ( 1 << (i + 1) ); - InitAudio( w, i ); + for( i = 0; i < hb_list_count( title->list_audio ); i++ ) + { + pv->busy |= ( 1 << (i + 1) ); + InitAudio( w, i ); + } } /* Get subtitle info, if any */ @@ -185,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 ); @@ -758,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.