summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-04-03 15:57:54 -0700
committerEric Laurent <elaurent@google.com>2015-04-08 12:37:35 -0700
commit322b4d25387a04c9afebe998326d005bbdf17ede (patch)
tree3cf0c2912dc7cb75acb60526bef382dd90e9a51d /services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
parent6dc4dc4ad23dc82eca9af3112292f3e6d5b17b15 (diff)
downloadframeworks_av-322b4d25387a04c9afebe998326d005bbdf17ede.zip
frameworks_av-322b4d25387a04c9afebe998326d005bbdf17ede.tar.gz
frameworks_av-322b4d25387a04c9afebe998326d005bbdf17ede.tar.bz2
audio policy: fix unique audio port ID.
Remove mId member from AudioPort as it was shadowed by mId in DeviceDescriptor. Add getters for Id, and HW module name and version to device, output and input descriptors. Fix DeviceDescriptor name initialization. Change-Id: I4a69f385e40330954d9dad5f2926c521f60b2ec1
Diffstat (limited to 'services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp')
-rw-r--r--services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
index fa66728..937160b 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
@@ -27,9 +27,9 @@
namespace android {
AudioInputDescriptor::AudioInputDescriptor(const sp<IOProfile>& profile)
- : mId(0), mIoHandle(0),
+ : mIoHandle(0),
mDevice(AUDIO_DEVICE_NONE), mPolicyMix(NULL), mPatchHandle(0), mRefCount(0),
- mInputSource(AUDIO_SOURCE_DEFAULT), mProfile(profile), mIsSoundTrigger(false)
+ mInputSource(AUDIO_SOURCE_DEFAULT), mProfile(profile), mIsSoundTrigger(false), mId(0)
{
if (profile != NULL) {
mSamplingRate = profile->pickSamplingRate();
@@ -49,9 +49,17 @@ void AudioInputDescriptor::setIoHandle(audio_io_handle_t ioHandle)
audio_module_handle_t AudioInputDescriptor::getModuleHandle() const
{
+ if (mProfile == 0) {
+ return 0;
+ }
return mProfile->getModuleHandle();
}
+audio_port_handle_t AudioInputDescriptor::getId() const
+{
+ return mId;
+}
+
void AudioInputDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig,
const struct audio_port_config *srcConfig) const
{
@@ -68,7 +76,7 @@ void AudioInputDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig
dstConfig->id = mId;
dstConfig->role = AUDIO_PORT_ROLE_SINK;
dstConfig->type = AUDIO_PORT_TYPE_MIX;
- dstConfig->ext.mix.hw_module = mProfile->mModule->mHandle;
+ dstConfig->ext.mix.hw_module = getModuleHandle();
dstConfig->ext.mix.handle = mIoHandle;
dstConfig->ext.mix.usecase.source = mInputSource;
}
@@ -80,7 +88,7 @@ void AudioInputDescriptor::toAudioPort(struct audio_port *port) const
mProfile->toAudioPort(port);
port->id = mId;
toAudioPortConfig(&port->active_config);
- port->ext.mix.hw_module = mProfile->mModule->mHandle;
+ port->ext.mix.hw_module = getModuleHandle();
port->ext.mix.handle = mIoHandle;
port->ext.mix.latency_class = AUDIO_LATENCY_NORMAL;
}
@@ -91,7 +99,7 @@ status_t AudioInputDescriptor::dump(int fd)
char buffer[SIZE];
String8 result;
- snprintf(buffer, SIZE, " ID: %d\n", mId);
+ snprintf(buffer, SIZE, " ID: %d\n", getId());
result.append(buffer);
snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate);
result.append(buffer);
@@ -130,7 +138,7 @@ sp<AudioInputDescriptor> AudioInputCollection::getInputFromId(audio_port_handle_
sp<AudioInputDescriptor> inputDesc = NULL;
for (size_t i = 0; i < size(); i++) {
inputDesc = valueAt(i);
- if (inputDesc->mId == id) {
+ if (inputDesc->getId() == id) {
break;
}
}