From a58e68f29a043b1399fffef09a77fcad75a10721 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sat, 15 Apr 2006 09:57:36 +0000 Subject: [PATCH] now, if you do stuff PROPERLY, it works. even with ffmpeg. Originally committed to SVN as r343. --- core/audio_provider_lavc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/audio_provider_lavc.cpp b/core/audio_provider_lavc.cpp index d8b960713..7fb1cf6af 100644 --- a/core/audio_provider_lavc.cpp +++ b/core/audio_provider_lavc.cpp @@ -93,7 +93,9 @@ LAVCAudioProvider::LAVCAudioProvider(wxString _filename, VideoProvider *vpro) throw _T("Failed to initialize resampling"); resample_ratio = (float)sample_rate / (float)codecContext->sample_rate; - num_samples = (__int64)(stream->duration / bytes_per_sample * resample_ratio); + + double length = (double)stream->duration * av_q2d(stream->time_base); + num_samples = (__int64)(length * sample_rate); buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); if (!buffer)