summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-03-05 20:38:43 +0100
committerJohns <johns98@gmx.net>2012-03-05 20:38:43 +0100
commitd6c6818ecfe2930494b2339515b7a25c1678f639 (patch)
treeef452e3ad31b1704d6774e8e3759f38d55fdad1a
parent181a0bb3720f615b9ef68235df4f50f396c31869 (diff)
downloadvdr-plugin-softhddevice-d6c6818ecfe2930494b2339515b7a25c1678f639.tar.gz
vdr-plugin-softhddevice-d6c6818ecfe2930494b2339515b7a25c1678f639.tar.bz2
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.
-rw-r--r--codec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/codec.c b/codec.c
index 400dd64..73776ff 100644
--- a/codec.c
+++ b/codec.c
@@ -931,7 +931,12 @@ static void CodecAudioSetClock(AudioDecoder * audio_decoder, int64_t pts)
if (audio_decoder->AvResample && audio_decoder->DriftCorr) {
int distance;
- distance = (pts_diff * audio_decoder->HwSampleRate) / (90 * 1000);
+ // 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);
+ }
av_resample_compensate(audio_decoder->AvResample,
audio_decoder->DriftCorr / 10, distance);
}