diff options
author | Eric Laurent <elaurent@google.com> | 2014-12-08 19:35:01 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-08 19:35:01 +0000 |
commit | c12caed177ec2d4912394be692854dc1d632b3c3 (patch) | |
tree | bb3d83364ca398d15761bb67cf484f7ab6433922 /services/audiopolicy | |
parent | 4ac5f97cc5440e566691a2431053c253b3577342 (diff) | |
parent | a9450bbc6274451bbb4241595d74d6ce9a4160d1 (diff) | |
download | frameworks_av-c12caed177ec2d4912394be692854dc1d632b3c3.zip frameworks_av-c12caed177ec2d4912394be692854dc1d632b3c3.tar.gz frameworks_av-c12caed177ec2d4912394be692854dc1d632b3c3.tar.bz2 |
am a9450bbc: am cbbe1ccc: Merge "audio policy: fix AudioPort parameter checks" into lmp-mr1-dev
* commit 'a9450bbc6274451bbb4241595d74d6ce9a4160d1':
audio policy: fix AudioPort parameter checks
Diffstat (limited to 'services/audiopolicy')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index b5a3d5b..3778704 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -6325,6 +6325,10 @@ void AudioPolicyManager::AudioPort::loadGains(cnode *root) status_t AudioPolicyManager::AudioPort::checkExactSamplingRate(uint32_t samplingRate) const { + if (mSamplingRates.isEmpty()) { + return NO_ERROR; + } + for (size_t i = 0; i < mSamplingRates.size(); i ++) { if (mSamplingRates[i] == samplingRate) { return NO_ERROR; @@ -6336,6 +6340,10 @@ status_t AudioPolicyManager::AudioPort::checkExactSamplingRate(uint32_t sampling status_t AudioPolicyManager::AudioPort::checkCompatibleSamplingRate(uint32_t samplingRate, uint32_t *updatedSamplingRate) const { + if (mSamplingRates.isEmpty()) { + return NO_ERROR; + } + // Search for the closest supported sampling rate that is above (preferred) // or below (acceptable) the desired sampling rate, within a permitted ratio. // The sampling rates do not need to be sorted in ascending order. @@ -6394,6 +6402,10 @@ status_t AudioPolicyManager::AudioPort::checkCompatibleSamplingRate(uint32_t sam status_t AudioPolicyManager::AudioPort::checkExactChannelMask(audio_channel_mask_t channelMask) const { + if (mChannelMasks.isEmpty()) { + return NO_ERROR; + } + for (size_t i = 0; i < mChannelMasks.size(); i++) { if (mChannelMasks[i] == channelMask) { return NO_ERROR; @@ -6405,6 +6417,10 @@ status_t AudioPolicyManager::AudioPort::checkExactChannelMask(audio_channel_mask status_t AudioPolicyManager::AudioPort::checkCompatibleChannelMask(audio_channel_mask_t channelMask) const { + if (mChannelMasks.isEmpty()) { + return NO_ERROR; + } + const bool isRecordThread = mType == AUDIO_PORT_TYPE_MIX && mRole == AUDIO_PORT_ROLE_SINK; for (size_t i = 0; i < mChannelMasks.size(); i ++) { // FIXME Does not handle multi-channel automatic conversions yet @@ -6428,6 +6444,10 @@ status_t AudioPolicyManager::AudioPort::checkCompatibleChannelMask(audio_channel status_t AudioPolicyManager::AudioPort::checkFormat(audio_format_t format) const { + if (mFormats.isEmpty()) { + return NO_ERROR; + } + for (size_t i = 0; i < mFormats.size(); i ++) { if (mFormats[i] == format) { return NO_ERROR; |