Workaround for av_resample_compensate ffmpeg bug.

FFmpeg commit a67cb012e6947fb238193afc0f18114f6e20818c or
1b9ca38d9d06d319fffd61d27e4eb385d6572ba8 breaks av_resample_compensate.
Only big sample_delta compensation_distance ratios are now working.
This commit is contained in:
Johns 2012-03-05 20:38:43 +01:00
parent 181a0bb372
commit d6c6818ecf

View File

@ -931,7 +931,12 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
if (audio_decoder->AvResample && audio_decoder->DriftCorr) { if (audio_decoder->AvResample && audio_decoder->DriftCorr) {
int distance; int distance;
// try workaround for buggy ffmpeg 0.10
if (audio_decoder->DriftCorr < 2000) {
distance = (pts_diff * audio_decoder->HwSampleRate) / (900 * 1000);
} else {
distance = (pts_diff * audio_decoder->HwSampleRate) / (90 * 1000); distance = (pts_diff * audio_decoder->HwSampleRate) / (90 * 1000);
}
av_resample_compensate(audio_decoder->AvResample, av_resample_compensate(audio_decoder->AvResample,
audio_decoder->DriftCorr / 10, distance); audio_decoder->DriftCorr / 10, distance);
} }