From 5aa868c296b0ae0e5cb09cbe714987b2e374be8c Mon Sep 17 00:00:00 2001 From: Johns Date: Wed, 29 Feb 2012 17:40:58 +0100 Subject: Don't change correction value during pass-through. --- codec.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'codec.c') diff --git a/codec.c b/codec.c index b247c4f..9d497c6 100644 --- a/codec.c +++ b/codec.c @@ -853,7 +853,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts) int64_t delay; int64_t tim_diff; int64_t pts_diff; - int64_t drift; + int drift; int corr; AudioSetClock(pts); @@ -897,7 +897,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts) if (abs(drift) > 5 * 90) { // drift too big, pts changed? - Debug(3, "codec/audio: drift(%5d) %3" PRId64 "ms reset\n", + Debug(3, "codec/audio: drift(%5d) %3dms reset\n", audio_decoder->DriftCorr, drift); audio_decoder->LastDelay = 0; return; @@ -906,7 +906,14 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts) drift += audio_decoder->Drift; audio_decoder->Drift = drift; corr = (10 * audio_decoder->HwSampleRate * drift) / (90 * 1000); - audio_decoder->DriftCorr -= corr; +#ifdef USE_PASSTHROUGH + // SPDIF/HDMI passthrough + if (!CodecPassthroughAC3 + || audio_decoder->AudioCtx->codec_id != CODEC_ID_AC3) +#endif + { + audio_decoder->DriftCorr -= corr; + } if (audio_decoder->DriftCorr < -20000) { // limit correction audio_decoder->DriftCorr = -20000; @@ -917,8 +924,8 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts) av_resample_compensate(audio_decoder->AvResample, audio_decoder->DriftCorr / 10, 10 * audio_decoder->HwSampleRate); } - printf("codec/audio: drift(%5d) %8" PRId64 "us %4d\n", - audio_decoder->DriftCorr, drift * 1000 / 90, corr); + printf("codec/audio: drift(%5d) %8dus %4d\n", audio_decoder->DriftCorr, + drift * 1000 / 90, corr); } /** -- cgit v1.2.3