diff options
author | Marco Nelissen <marcone@google.com> | 2014-08-27 17:58:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-27 17:58:15 +0000 |
commit | 60ffbe05857b7583f4c70c31914947476a908b5b (patch) | |
tree | 1c041f7543d800c3a378f19ee0ebaf490ad4ef54 /services | |
parent | 9dd4a2ddd7caf8cbe50d8a76e0ec3e0274d2bce6 (diff) | |
parent | 961ec21a5878517ce6db27bad8da269637c45a44 (diff) | |
download | frameworks_av-60ffbe05857b7583f4c70c31914947476a908b5b.zip frameworks_av-60ffbe05857b7583f4c70c31914947476a908b5b.tar.gz frameworks_av-60ffbe05857b7583f4c70c31914947476a908b5b.tar.bz2 |
Merge "Fix memory leak in getConnectionState" into lmp-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 16 | ||||
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.h | 5 |
2 files changed, 11 insertions, 10 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 14fdec5..b643eac 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -3874,7 +3874,7 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate if (((mAvailableInputDevices.types() & AUDIO_DEVICE_IN_TELEPHONY_RX & ~AUDIO_DEVICE_BIT_IN) == 0) || (((txDevice & availablePrimaryInputDevices() & ~AUDIO_DEVICE_BIT_IN) != 0) && - (hwOutputDesc->mAudioPort->mModule->mHalVersion < + (hwOutputDesc->getAudioPort()->mModule->mHalVersion < AUDIO_DEVICE_API_VERSION_3_0))) { availableOutputDeviceTypes = availablePrimaryOutputDevices(); } @@ -5070,7 +5070,6 @@ AudioPolicyManager::AudioOutputDescriptor::AudioOutputDescriptor( mStrategyMutedByDevice[i] = false; } if (profile != NULL) { - mAudioPort = profile; mFlags = profile->mFlags; mSamplingRate = profile->pickSamplingRate(); mFormat = profile->pickFormat(); @@ -5253,7 +5252,6 @@ AudioPolicyManager::AudioInputDescriptor::AudioInputDescriptor(const sp<IOProfil mInputSource(AUDIO_SOURCE_DEFAULT), mProfile(profile), mIsSoundTrigger(false) { if (profile != NULL) { - mAudioPort = profile; mSamplingRate = profile->pickSamplingRate(); mFormat = profile->pickFormat(); mChannelMask = profile->pickChannelMask(); @@ -6273,33 +6271,34 @@ status_t AudioPolicyManager::AudioPortConfig::applyAudioPortConfig( localBackupConfig.config_mask = config->config_mask; toAudioPortConfig(&localBackupConfig); - if (mAudioPort == 0) { + sp<AudioPort> audioport = getAudioPort(); + if (audioport == 0) { status = NO_INIT; goto exit; } if (config->config_mask & AUDIO_PORT_CONFIG_SAMPLE_RATE) { - status = mAudioPort->checkExactSamplingRate(config->sample_rate); + status = audioport->checkExactSamplingRate(config->sample_rate); if (status != NO_ERROR) { goto exit; } mSamplingRate = config->sample_rate; } if (config->config_mask & AUDIO_PORT_CONFIG_CHANNEL_MASK) { - status = mAudioPort->checkExactChannelMask(config->channel_mask); + status = audioport->checkExactChannelMask(config->channel_mask); if (status != NO_ERROR) { goto exit; } mChannelMask = config->channel_mask; } if (config->config_mask & AUDIO_PORT_CONFIG_FORMAT) { - status = mAudioPort->checkFormat(config->format); + status = audioport->checkFormat(config->format); if (status != NO_ERROR) { goto exit; } mFormat = config->format; } if (config->config_mask & AUDIO_PORT_CONFIG_GAIN) { - status = mAudioPort->checkGain(&config->gain, config->gain.index); + status = audioport->checkGain(&config->gain, config->gain.index); if (status != NO_ERROR) { goto exit; } @@ -6486,7 +6485,6 @@ AudioPolicyManager::DeviceDescriptor::DeviceDescriptor(const String8& name, audi NULL), mDeviceType(type), mAddress(""), mId(0) { - mAudioPort = this; if (mGains.size() > 0) { mGains[0]->getDefaultConfig(&mGain); } diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index e3e3172..6712eb7 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -297,7 +297,7 @@ protected: struct audio_port_config *backupConfig = NULL); virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const = 0; - sp<AudioPort> mAudioPort; + virtual sp<AudioPort> getAudioPort() const = 0; uint32_t mSamplingRate; audio_format_t mFormat; audio_channel_mask_t mChannelMask; @@ -330,6 +330,7 @@ protected: bool equals(const sp<DeviceDescriptor>& other) const; virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const; + virtual sp<AudioPort> getAudioPort() const { return (AudioPort*) this; } virtual void toAudioPort(struct audio_port *port) const; @@ -462,6 +463,7 @@ protected: virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const; + virtual sp<AudioPort> getAudioPort() const { return mProfile; } void toAudioPort(struct audio_port *port) const; audio_port_handle_t mId; @@ -506,6 +508,7 @@ protected: virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const; + virtual sp<AudioPort> getAudioPort() const { return mProfile; } void toAudioPort(struct audio_port *port) const; }; |