summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfoobum <foobum@gmail.com>2011-01-09 21:10:01 (GMT)
committer Jean-Yves Avenard <jyavenard@mythtv.org>2011-01-29 23:52:00 (GMT)
commit06c8142bca34d8d8dc8f804c69f56befe1cce8ad (patch)
treec8b03cfbcb169ce5bba09e083a76ff9fd1bfb8c6
parentc884505bfc1f75ef852f1e5ad358138aa9205857 (diff)
AOBASE: SRC was setup with 'source_channels' but if we downmix we only get 'channels'
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
-rw-r--r--mythtv/libs/libmyth/audiooutputbase.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/mythtv/libs/libmyth/audiooutputbase.cpp b/mythtv/libs/libmyth/audiooutputbase.cpp
index 0f46bef..aeb8261 100644
--- a/mythtv/libs/libmyth/audiooutputbase.cpp
+++ b/mythtv/libs/libmyth/audiooutputbase.cpp
@@ -466,7 +466,9 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
.arg(settings.samplerate/1000).arg(samplerate/1000)
.arg(quality_string(src_quality)));
- src_ctx = src_new(2-src_quality, source_channels, &error);
+ int chans = needs_downmix ? channels : source_channels;
+
+ src_ctx = src_new(2-src_quality, chans, &error);
if (error)
{
Error(QString("Error creating resampler: %1")
@@ -475,11 +477,11 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
return;
}
- src_data.src_ratio = (double)samplerate / settings.samplerate;
- src_data.data_in = src_in;
- int newsize = ((long)((float)kAudioSRCInputSize *
- samplerate / settings.samplerate) +
- 15) & ~0xf;
+ src_data.src_ratio = (double)samplerate / settings.samplerate;
+ src_data.data_in = src_in;
+ int newsize = (int)(kAudioSRCInputSize * src_data.src_ratio + 15)
+ & ~0xf;
+
if (kAudioSRCOutputSize < newsize)
{
kAudioSRCOutputSize = newsize;