-
- if( NeedSilence( w, audio, i ) )
- {
- InsertSilence( w, i, (90000 * AC3_SAMPLES_PER_FRAME) /
- sync->audio->config.in.samplerate );
- }
-}
-
-static int NeedSilence( hb_work_object_t * w, hb_audio_t * audio, int i )
-{
- hb_work_private_t * pv = w->private_data;
- hb_job_t * job = pv->job;
- hb_sync_audio_t * sync = &pv->sync_audio[i];
-
- if( hb_fifo_size( audio->priv.fifo_in ) ||
- hb_fifo_size( audio->priv.fifo_raw ) ||
- hb_fifo_size( audio->priv.fifo_sync ) ||
- hb_fifo_size( audio->priv.fifo_out ) )
- {
- /* We have some audio, we are fine */
- return 0;
- }
-
- /* No audio left in fifos */
-
- if( hb_thread_has_exited( job->reader ) )
- {
- /* We might miss some audio to complete encoding and muxing
- the video track */
- if ( sync->start_silence == 0 )
- {
- hb_log("sync: reader has exited, adding silence to audio %d", i);
- sync->start_silence = sync->next_pts;
- }
- return 1;
- }
- return 0;