summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-04-16 12:43:57 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-04-18 09:29:45 -0700
commitacb86cccbd9d245439a04cef0bcefa589addaa4c (patch)
tree597fe66a314f3bc8a4c1746f9d9bbff0a8bd1067 /services/audioflinger/AudioMixer.cpp
parent97b5d0d5b5ef766eb5dd680d05a5d199662d4ae0 (diff)
downloadframeworks_av-acb86cccbd9d245439a04cef0bcefa589addaa4c.zip
frameworks_av-acb86cccbd9d245439a04cef0bcefa589addaa4c.tar.gz
frameworks_av-acb86cccbd9d245439a04cef0bcefa589addaa4c.tar.bz2
Configure the resampler with the correct channel count when downmixing
When a track needs to be downmixed and resampled, it gets downmixed first before being resampled. Therefore the resampler needs to be configured with the channel count of the output of the downmixer instead of that of the track. Removed frame size checks that don't apply anymore now that we support frame sizes that are not powers of 2 (e.g. 12 for 5.1 16bits), and changed test performed for every buffer during playback into an assert. Change-Id: Ia220f00ee382f4f7848b661c58555bdca664e194
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r--services/audioflinger/AudioMixer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 100f289..4c9e04a 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -98,7 +98,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTr
{
// AudioMixer is not yet capable of multi-channel beyond stereo
COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS);
-
+
ALOG_ASSERT(maxNumTracks <= MAX_NUM_TRACKS, "maxNumTracks %u > MAX_NUM_TRACKS %u",
maxNumTracks, MAX_NUM_TRACKS);
@@ -504,7 +504,10 @@ bool AudioMixer::track_t::setResampler(uint32_t value, uint32_t devSampleRate)
sampleRate = value;
if (resampler == NULL) {
resampler = AudioResampler::create(
- format, channelCount, devSampleRate);
+ format,
+ // the resampler sees the number of channels after the downmixer, if any
+ downmixerBufferProvider != NULL ? MAX_NUM_CHANNELS : channelCount,
+ devSampleRate);
resampler->setLocalTimeFreq(localTimeFreq);
}
return true;