mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Don't change correction value during pass-through.
This commit is contained in:
parent
43b48224b5
commit
5aa868c296
15
codec.c
15
codec.c
@ -853,7 +853,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
int64_t delay;
|
int64_t delay;
|
||||||
int64_t tim_diff;
|
int64_t tim_diff;
|
||||||
int64_t pts_diff;
|
int64_t pts_diff;
|
||||||
int64_t drift;
|
int drift;
|
||||||
int corr;
|
int corr;
|
||||||
|
|
||||||
AudioSetClock(pts);
|
AudioSetClock(pts);
|
||||||
@ -897,7 +897,7 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
|
|
||||||
if (abs(drift) > 5 * 90) {
|
if (abs(drift) > 5 * 90) {
|
||||||
// drift too big, pts changed?
|
// 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->DriftCorr, drift);
|
||||||
audio_decoder->LastDelay = 0;
|
audio_decoder->LastDelay = 0;
|
||||||
return;
|
return;
|
||||||
@ -906,7 +906,14 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
drift += audio_decoder->Drift;
|
drift += audio_decoder->Drift;
|
||||||
audio_decoder->Drift = drift;
|
audio_decoder->Drift = drift;
|
||||||
corr = (10 * audio_decoder->HwSampleRate * drift) / (90 * 1000);
|
corr = (10 * audio_decoder->HwSampleRate * drift) / (90 * 1000);
|
||||||
|
#ifdef USE_PASSTHROUGH
|
||||||
|
// SPDIF/HDMI passthrough
|
||||||
|
if (!CodecPassthroughAC3
|
||||||
|
|| audio_decoder->AudioCtx->codec_id != CODEC_ID_AC3)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
audio_decoder->DriftCorr -= corr;
|
audio_decoder->DriftCorr -= corr;
|
||||||
|
}
|
||||||
|
|
||||||
if (audio_decoder->DriftCorr < -20000) { // limit correction
|
if (audio_decoder->DriftCorr < -20000) { // limit correction
|
||||||
audio_decoder->DriftCorr = -20000;
|
audio_decoder->DriftCorr = -20000;
|
||||||
@ -917,8 +924,8 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
|
|||||||
av_resample_compensate(audio_decoder->AvResample,
|
av_resample_compensate(audio_decoder->AvResample,
|
||||||
audio_decoder->DriftCorr / 10, 10 * audio_decoder->HwSampleRate);
|
audio_decoder->DriftCorr / 10, 10 * audio_decoder->HwSampleRate);
|
||||||
}
|
}
|
||||||
printf("codec/audio: drift(%5d) %8" PRId64 "us %4d\n",
|
printf("codec/audio: drift(%5d) %8dus %4d\n", audio_decoder->DriftCorr,
|
||||||
audio_decoder->DriftCorr, drift * 1000 / 90, corr);
|
drift * 1000 / 90, corr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user