Skip to content

Commit 1e8b118

Browse files
gkastenAndroid (Google) Code Review
authored andcommitted
Merge "AudioPolicyService InputDesc minor cleanup"
2 parents a64890a + fcf2ac0 commit 1e8b118

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

services/audioflinger/AudioPolicyService.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource,
298298
ssize_t idx = mInputs.indexOfKey(input);
299299
InputDesc *inputDesc;
300300
if (idx < 0) {
301-
inputDesc = new InputDesc();
302-
inputDesc->mSessionId = audioSession;
301+
inputDesc = new InputDesc(audioSession);
303302
mInputs.add(input, inputDesc);
304303
} else {
305304
inputDesc = mInputs.valueAt(idx);
@@ -358,7 +357,6 @@ void AudioPolicyService::releaseInput(audio_io_handle_t input)
358357
}
359358
InputDesc *inputDesc = mInputs.valueAt(index);
360359
setPreProcessorEnabled(inputDesc, false);
361-
inputDesc->mEffects.clear();
362360
delete inputDesc;
363361
mInputs.removeItemsAt(index);
364362
}
@@ -602,9 +600,9 @@ status_t AudioPolicyService::dumpPermissionDenial(int fd)
602600
return NO_ERROR;
603601
}
604602

605-
void AudioPolicyService::setPreProcessorEnabled(InputDesc *inputDesc, bool enabled)
603+
void AudioPolicyService::setPreProcessorEnabled(const InputDesc *inputDesc, bool enabled)
606604
{
607-
Vector<sp<AudioEffect> > fxVector = inputDesc->mEffects;
605+
const Vector<sp<AudioEffect> > &fxVector = inputDesc->mEffects;
608606
for (size_t i = 0; i < fxVector.size(); i++) {
609607
fxVector.itemAt(i)->setEnabled(enabled);
610608
}

services/audioflinger/AudioPolicyService.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,15 @@ class AudioPolicyService :
279279

280280
class InputDesc {
281281
public:
282-
InputDesc() {}
283-
virtual ~InputDesc() {}
284-
int mSessionId;
282+
InputDesc(int session) : mSessionId(session) {}
283+
/*virtual*/ ~InputDesc() {}
284+
const int mSessionId;
285285
Vector< sp<AudioEffect> >mEffects;
286286
};
287287

288288
static const char * const kInputSourceNames[AUDIO_SOURCE_CNT -1];
289289

290-
void setPreProcessorEnabled(InputDesc *inputDesc, bool enabled);
290+
void setPreProcessorEnabled(const InputDesc *inputDesc, bool enabled);
291291
status_t loadPreProcessorConfig(const char *path);
292292
status_t loadEffects(cnode *root, Vector <EffectDesc *>& effects);
293293
EffectDesc *loadEffect(cnode *root);

0 commit comments

Comments
 (0)