Skip to content
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 d78edbd commit 0c676b253097bbe86466ec04474e433bca839ff0 @foobum foobum committed with jyavenard Jan 9, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 mythtv/libs/libmyth/audio/audiooutputbase.cpp
View
14 mythtv/libs/libmyth/audio/audiooutputbase.cpp
@@ -481,7 +481,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")
@@ -490,11 +492,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 0c676b2

Please sign in to comment.
Something went wrong with that request. Please try again.