Permalink
Browse files

AOBASE: SRC was setup with 'source_channels' but if we downmix we onl…

…y get 'channels'

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
  • Loading branch information...
1 parent c884505 commit 06c8142bca34d8d8dc8f804c69f56befe1cce8ad @foobum foobum committed with jyavenard Jan 9, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 mythtv/libs/libmyth/audiooutputbase.cpp
View
14 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;

0 comments on commit 06c8142

Please sign in to comment.