summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Glenn Kasten <gkasten@google.com> 2012-03-07 16:49:22 -0800
committer Glenn Kasten <gkasten@google.com> 2012-03-08 16:30:00 -0800
commitfcf2ac041e18fd5cd97997bfd2bce62e9a24fe19 (patch)
treefad2a07336e8ab225e3e3e2c87b6a39acc287bfc
parent21b4d6b7a5959b567355aae032bd76500c148e54 (diff)
AudioPolicyService InputDesc minor cleanup
Add a non-default constructor to set the mSessionId, and make mSessionId const. Remove explicit clear on mEffects - it is automatically cleared by the destructor. AudioPolicyService::setPreProcessorEnabled: - parameter is const * - use an alias instead of making a Vector copy Destructor doesn't need to be virtual since there are no subclasses. Change-Id: Ibc3c3bea8259839430b1cf5356186c7d96f1082f
-rw-r--r--services/audioflinger/AudioPolicyService.cpp8
-rw-r--r--services/audioflinger/AudioPolicyService.h8
2 files changed, 7 insertions, 9 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 753b1d248323..7487f4bf94e8 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -298,8 +298,7 @@ audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource,
ssize_t idx = mInputs.indexOfKey(input);
InputDesc *inputDesc;
if (idx < 0) {
- inputDesc = new InputDesc();
- inputDesc->mSessionId = audioSession;
+ inputDesc = new InputDesc(audioSession);
mInputs.add(input, inputDesc);
} else {
inputDesc = mInputs.valueAt(idx);
@@ -358,7 +357,6 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input)
}
InputDesc *inputDesc = mInputs.valueAt(index);
setPreProcessorEnabled(inputDesc, false);
- inputDesc->mEffects.clear();
delete inputDesc;
mInputs.removeItemsAt(index);
}
@@ -600,9 +598,9 @@ status_t AudioPolicyService::dumpPermissionDenial(int fd)
return NO_ERROR;
}
-void AudioPolicyService::setPreProcessorEnabled(InputDesc *inputDesc, bool enabled)
+void AudioPolicyService::setPreProcessorEnabled(const InputDesc *inputDesc, bool enabled)
{
- Vector<sp<AudioEffect> > fxVector = inputDesc->mEffects;
+ const Vector<sp<AudioEffect> > &fxVector = inputDesc->mEffects;
for (size_t i = 0; i < fxVector.size(); i++) {
fxVector.itemAt(i)->setEnabled(enabled);
}
diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h
index 962c91750bd9..106bf6a9c3a2 100644
--- a/services/audioflinger/AudioPolicyService.h
+++ b/services/audioflinger/AudioPolicyService.h
@@ -279,15 +279,15 @@ private:
class InputDesc {
public:
- InputDesc() {}
- virtual ~InputDesc() {}
- int mSessionId;
+ InputDesc(int session) : mSessionId(session) {}
+ /*virtual*/ ~InputDesc() {}
+ const int mSessionId;
Vector< sp<AudioEffect> >mEffects;
};
static const char * const kInputSourceNames[AUDIO_SOURCE_CNT -1];
- void setPreProcessorEnabled(InputDesc *inputDesc, bool enabled);
+ void setPreProcessorEnabled(const InputDesc *inputDesc, bool enabled);
status_t loadPreProcessorConfig(const char *path);
status_t loadEffects(cnode *root, Vector <EffectDesc *>& effects);
EffectDesc *loadEffect(cnode *root);