Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +18 −8 Original line number Original line Diff line number Diff line Loading @@ -1325,10 +1325,15 @@ status_t AudioPolicyManager::getOutputForAttrInt( AudioProfileVector profiles; AudioProfileVector profiles; status_t ret = getProfilesForDevices(outputDevices, profiles, *flags, false /*isInput*/); status_t ret = getProfilesForDevices(outputDevices, profiles, *flags, false /*isInput*/); if (ret == NO_ERROR && !profiles.empty()) { if (ret == NO_ERROR && !profiles.empty()) { config->channel_mask = profiles[0]->getChannels().empty() ? config->channel_mask const auto channels = profiles[0]->getChannels(); : *profiles[0]->getChannels().begin(); if (!channels.empty() && (channels.find(config->channel_mask) == channels.end())) { config->sample_rate = profiles[0]->getSampleRates().empty() ? config->sample_rate config->channel_mask = *channels.begin(); : *profiles[0]->getSampleRates().begin(); } const auto sampleRates = profiles[0]->getSampleRates(); if (!sampleRates.empty() && (sampleRates.find(config->sample_rate) == sampleRates.end())) { config->sample_rate = *sampleRates.begin(); } config->format = profiles[0]->getFormat(); config->format = profiles[0]->getFormat(); } } return INVALID_OPERATION; return INVALID_OPERATION; Loading Loading @@ -2774,10 +2779,15 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr, status_t ret = getProfilesForDevices( status_t ret = getProfilesForDevices( DeviceVector(device), profiles, flags, true /*isInput*/); DeviceVector(device), profiles, flags, true /*isInput*/); if (ret == NO_ERROR && !profiles.empty()) { if (ret == NO_ERROR && !profiles.empty()) { config->channel_mask = profiles[0]->getChannels().empty() ? config->channel_mask const auto channels = profiles[0]->getChannels(); : *profiles[0]->getChannels().begin(); if (!channels.empty() && (channels.find(config->channel_mask) == channels.end())) { config->sample_rate = profiles[0]->getSampleRates().empty() ? config->sample_rate config->channel_mask = *channels.begin(); : *profiles[0]->getSampleRates().begin(); } const auto sampleRates = profiles[0]->getSampleRates(); if (!sampleRates.empty() && (sampleRates.find(config->sample_rate) == sampleRates.end())) { config->sample_rate = *sampleRates.begin(); } config->format = profiles[0]->getFormat(); config->format = profiles[0]->getFormat(); } } goto error; goto error; Loading Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +18 −8 Original line number Original line Diff line number Diff line Loading @@ -1325,10 +1325,15 @@ status_t AudioPolicyManager::getOutputForAttrInt( AudioProfileVector profiles; AudioProfileVector profiles; status_t ret = getProfilesForDevices(outputDevices, profiles, *flags, false /*isInput*/); status_t ret = getProfilesForDevices(outputDevices, profiles, *flags, false /*isInput*/); if (ret == NO_ERROR && !profiles.empty()) { if (ret == NO_ERROR && !profiles.empty()) { config->channel_mask = profiles[0]->getChannels().empty() ? config->channel_mask const auto channels = profiles[0]->getChannels(); : *profiles[0]->getChannels().begin(); if (!channels.empty() && (channels.find(config->channel_mask) == channels.end())) { config->sample_rate = profiles[0]->getSampleRates().empty() ? config->sample_rate config->channel_mask = *channels.begin(); : *profiles[0]->getSampleRates().begin(); } const auto sampleRates = profiles[0]->getSampleRates(); if (!sampleRates.empty() && (sampleRates.find(config->sample_rate) == sampleRates.end())) { config->sample_rate = *sampleRates.begin(); } config->format = profiles[0]->getFormat(); config->format = profiles[0]->getFormat(); } } return INVALID_OPERATION; return INVALID_OPERATION; Loading Loading @@ -2774,10 +2779,15 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr, status_t ret = getProfilesForDevices( status_t ret = getProfilesForDevices( DeviceVector(device), profiles, flags, true /*isInput*/); DeviceVector(device), profiles, flags, true /*isInput*/); if (ret == NO_ERROR && !profiles.empty()) { if (ret == NO_ERROR && !profiles.empty()) { config->channel_mask = profiles[0]->getChannels().empty() ? config->channel_mask const auto channels = profiles[0]->getChannels(); : *profiles[0]->getChannels().begin(); if (!channels.empty() && (channels.find(config->channel_mask) == channels.end())) { config->sample_rate = profiles[0]->getSampleRates().empty() ? config->sample_rate config->channel_mask = *channels.begin(); : *profiles[0]->getSampleRates().begin(); } const auto sampleRates = profiles[0]->getSampleRates(); if (!sampleRates.empty() && (sampleRates.find(config->sample_rate) == sampleRates.end())) { config->sample_rate = *sampleRates.begin(); } config->format = profiles[0]->getFormat(); config->format = profiles[0]->getFormat(); } } goto error; goto error; Loading