audio vts: Remove explicit dependency on the new types

Avoid using the new ChannelMaskSet and SampleRateSet types
directly to simplify upstreaming.

Bug: 141989952
Bug: 141847510
Test: atest VtsHalAudioV5_0TargetTest
Change-Id: I4477334be0375a95d79324a3ab38b03eb3f9998f
This commit is contained in:
Mikhail Naganov
2019-11-08 15:15:09 -08:00
parent 9cd7668fcf
commit 4e9c4061ca
2 changed files with 14 additions and 8 deletions

View File

@@ -73,9 +73,12 @@ const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() {
getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device));
for (const auto& ioProfile : module->getOutputProfiles()) {
for (const auto& profile : ioProfile->getAudioProfiles()) {
auto configs = ConfigHelper::combineAudioConfig(profile->getChannels(),
profile->getSampleRates(),
profile->getFormat());
const auto& channels = profile->getChannels();
const auto& sampleRates = profile->getSampleRates();
auto configs = ConfigHelper::combineAudioConfig(
vector<audio_channel_mask_t>(channels.begin(), channels.end()),
vector<uint32_t>(sampleRates.begin(), sampleRates.end()),
profile->getFormat());
auto flags = ioProfile->getFlags();
for (auto& config : configs) {
// Some combinations of flags declared in the config file require special
@@ -125,9 +128,12 @@ const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() {
getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device));
for (const auto& ioProfile : module->getInputProfiles()) {
for (const auto& profile : ioProfile->getAudioProfiles()) {
auto configs = ConfigHelper::combineAudioConfig(profile->getChannels(),
profile->getSampleRates(),
profile->getFormat());
const auto& channels = profile->getChannels();
const auto& sampleRates = profile->getSampleRates();
auto configs = ConfigHelper::combineAudioConfig(
vector<audio_channel_mask_t>(channels.begin(), channels.end()),
vector<uint32_t>(sampleRates.begin(), sampleRates.end()),
profile->getFormat());
for (const auto& config : configs) {
result.emplace_back(device, config, AudioInputFlag(ioProfile->getFlags()));
}

View File

@@ -79,8 +79,8 @@ struct ConfigHelper {
return {};
}
static vector<AudioConfig> combineAudioConfig(android::ChannelMaskSet channelMasks,
android::SampleRateSet sampleRates,
static vector<AudioConfig> combineAudioConfig(vector<audio_channel_mask_t> channelMasks,
vector<uint32_t> sampleRates,
audio_format_t format) {
vector<AudioConfig> configs;
configs.reserve(channelMasks.size() * sampleRates.size());