diff options
author | Eric Laurent <elaurent@google.com> | 2015-01-27 18:21:09 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2015-01-27 18:21:09 -0800 |
commit | 1db89b9c2692fd70eb1cc98b7db2f9beed81e66e (patch) | |
tree | beb7c19359bcc63ef6bbf918bf3b4a6ffe2a3003 /services/audiopolicy | |
parent | 64c496c8d51c71605cd34a510da2ecd8180656ec (diff) | |
download | frameworks_av-1db89b9c2692fd70eb1cc98b7db2f9beed81e66e.zip frameworks_av-1db89b9c2692fd70eb1cc98b7db2f9beed81e66e.tar.gz frameworks_av-1db89b9c2692fd70eb1cc98b7db2f9beed81e66e.tar.bz2 |
Audio policy: fix device gain initialization
Fix initilization of default gain configuration for
audio devices loaded from audio_policy.conf.
Initialization cannot be done in constructor as the possible
gain configurations are not loaded yet.
Bug: 19120566.
Change-Id: I78f057ecfa1a121365ac3d8f317912a6f1647627
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 12 | ||||
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.h | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 0349327..fb74d66 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -7449,9 +7449,6 @@ AudioPolicyManager::DeviceDescriptor::DeviceDescriptor(const String8& name, audi NULL), mDeviceType(type), mAddress(""), mId(0) { - if (mGains.size() > 0) { - mGains[0]->getDefaultConfig(&mGain); - } } bool AudioPolicyManager::DeviceDescriptor::equals(const sp<DeviceDescriptor>& other) const @@ -7466,6 +7463,15 @@ bool AudioPolicyManager::DeviceDescriptor::equals(const sp<DeviceDescriptor>& ot mChannelMask == other->mChannelMask); } +void AudioPolicyManager::DeviceDescriptor::loadGains(cnode *root) +{ + AudioPort::loadGains(root); + if (mGains.size() > 0) { + mGains[0]->getDefaultConfig(&mGain); + } +} + + void AudioPolicyManager::DeviceVector::refreshTypes() { mDeviceTypes = AUDIO_DEVICE_NONE; diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index 0fa182b..2bc91e1 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -264,7 +264,7 @@ protected: audio_gain_mode_t loadGainMode(char *name); void loadGain(cnode *root, int index); - void loadGains(cnode *root); + virtual void loadGains(cnode *root); // searches for an exact match status_t checkExactSamplingRate(uint32_t samplingRate) const; @@ -344,10 +344,14 @@ protected: virtual ~DeviceDescriptor() {} bool equals(const sp<DeviceDescriptor>& other) const; + + // AudioPortConfig + virtual sp<AudioPort> getAudioPort() const { return (AudioPort*) this; } virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const; - virtual sp<AudioPort> getAudioPort() const { return (AudioPort*) this; } + // AudioPort + virtual void loadGains(cnode *root); virtual void toAudioPort(struct audio_port *port) const; status_t dump(int fd, int spaces, int index) const; |