diff options
author | Sean McNeil <sean.mcneil@windriver.com> | 2010-09-01 14:06:11 +0700 |
---|---|---|
committer | Sean McNeil <sean.mcneil@windriver.com> | 2010-09-01 14:06:11 +0700 |
commit | 4aedfad24855f6100b7a0d6c4bf1b6118527f2ec (patch) | |
tree | 4c46f017cfb8ac3da28239fdaaef185a8fae3c15 | |
parent | 621bc21b12d0c4fb2f0f90ebf64b2f34d5233d38 (diff) | |
download | alsa_sound-4aedfad24855f6100b7a0d6c4bf1b6118527f2ec.tar.gz |
Support no ALSA mixing.
When no ALSA controls can be found, do not treat as a fatal condition.
Instead, report back to callers that the operation is not supported.
This will cause Audioflinger to perform software volume mixing instead.
Change-Id: I2843433c2cd3ed45e4888000f823aa5f34d3b5f7
-rw-r--r-- | ALSAMixer.cpp | 4 | ||||
-rw-r--r-- | AudioHardwareALSA.cpp | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ALSAMixer.cpp b/ALSAMixer.cpp index 8bae00a..ed236c1 100644 --- a/ALSAMixer.cpp +++ b/ALSAMixer.cpp @@ -1,6 +1,6 @@ /* ALSAMixer.cpp ** - ** Copyright 2008-2009 Wind River Systems + ** Copyright 2008-2010 Wind River Systems ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -169,6 +169,8 @@ ALSAMixer::ALSAMixer() for (int i = 0; i <= SND_PCM_STREAM_LAST; i++) { + if (!mMixer[i]) continue; + mixer_info_t *info = mixerMasterProp[i].mInfo = new mixer_info_t; property_get (mixerMasterProp[i].propName, diff --git a/AudioHardwareALSA.cpp b/AudioHardwareALSA.cpp index 46dfd4e..bff4534 100644 --- a/AudioHardwareALSA.cpp +++ b/AudioHardwareALSA.cpp @@ -1,6 +1,6 @@ /* AudioHardwareALSA.cpp ** - ** Copyright 2008-2009 Wind River Systems + ** Copyright 2008-2010 Wind River Systems ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -117,10 +117,13 @@ AudioHardwareALSA::~AudioHardwareALSA() status_t AudioHardwareALSA::initCheck() { - if (mALSADevice && mMixer && mMixer->isValid()) - return NO_ERROR; - else + if (!mALSADevice) return NO_INIT; + + if (!mMixer || !mMixer->isValid()) + LOGW("ALSA Mixer is not valid. AudioFlinger will do software volume control."); + + return NO_ERROR; } status_t AudioHardwareALSA::setVoiceVolume(float volume) |