summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.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/AudioOutputDescriptor.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/AudioOutputDescriptor.cpp')
-rw-r--r--services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index 7207a71..8de8cd8 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -30,10 +30,11 @@
namespace android {
AudioOutputDescriptor::AudioOutputDescriptor(const sp<IOProfile>& profile)
- : mId(0), mIoHandle(0), mLatency(0),
+ : mIoHandle(0), mLatency(0),
mFlags((audio_output_flags_t)0), mDevice(AUDIO_DEVICE_NONE), mPolicyMix(NULL),
mPatchHandle(0),
- mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0)
+ mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0),
+ mId(0)
{
// clear usage count for all stream types
for (int i = 0; i < AUDIO_STREAM_CNT; i++) {
@@ -58,9 +59,17 @@ AudioOutputDescriptor::AudioOutputDescriptor(const sp<IOProfile>& profile)
audio_module_handle_t AudioOutputDescriptor::getModuleHandle() const
{
+ if (mProfile == 0) {
+ return 0;
+ }
return mProfile->getModuleHandle();
}
+audio_port_handle_t AudioOutputDescriptor::getId() const
+{
+ return mId;
+}
+
audio_devices_t AudioOutputDescriptor::device() const
{
if (isDuplicated()) {
@@ -93,7 +102,7 @@ bool AudioOutputDescriptor::sharesHwModuleWith(
} else if (outputDesc->isDuplicated()){
return sharesHwModuleWith(outputDesc->mOutput1) || sharesHwModuleWith(outputDesc->mOutput2);
} else {
- return (mProfile->mModule == outputDesc->mProfile->mModule);
+ return (getModuleHandle() == outputDesc->getModuleHandle());
}
}
@@ -176,7 +185,7 @@ void AudioOutputDescriptor::toAudioPortConfig(
dstConfig->id = mId;
dstConfig->role = AUDIO_PORT_ROLE_SOURCE;
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.stream = AUDIO_STREAM_DEFAULT;
}
@@ -188,7 +197,7 @@ void AudioOutputDescriptor::toAudioPort(
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 =
mFlags & AUDIO_OUTPUT_FLAG_FAST ? AUDIO_LATENCY_LOW : AUDIO_LATENCY_NORMAL;
@@ -200,7 +209,7 @@ status_t AudioOutputDescriptor::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);
@@ -289,7 +298,7 @@ sp<AudioOutputDescriptor> AudioOutputCollection::getOutputFromId(audio_port_hand
sp<AudioOutputDescriptor> outputDesc = NULL;
for (size_t i = 0; i < size(); i++) {
outputDesc = valueAt(i);
- if (outputDesc->mId == id) {
+ if (outputDesc->getId() == id) {
break;
}
}