From 322b4d25387a04c9afebe998326d005bbdf17ede Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 3 Apr 2015 15:57:54 -0700 Subject: 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 --- .../managerdefinitions/src/AudioInputDescriptor.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp') 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& 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 AudioInputCollection::getInputFromId(audio_port_handle_ sp inputDesc = NULL; for (size_t i = 0; i < size(); i++) { inputDesc = valueAt(i); - if (inputDesc->mId == id) { + if (inputDesc->getId() == id) { break; } } -- cgit v1.1