Loading services/audiopolicy/common/managerdefinitions/include/AudioIODescriptorInterface.h +17 −4 Original line number Diff line number Diff line Loading @@ -41,12 +41,25 @@ sp<DeviceDescriptor> findPreferredDevice( IoDescriptor& desc, Filter filter, bool& active, const DeviceVector& devices) { auto activeClients = desc->clientsList(true /*activeOnly*/); active = activeClients.size() > 0; if (active) { // On MMAP IOs, the preferred device is selected by the first client (virtual client // created when the mmap stream is opened). This client is never active. // On non MMAP IOs, the preferred device is honored only if all active clients have // a preferred device in which case the first client drives the selection. if (desc->getPolicyAudioPort()->isMmap()) { // The client list is never empty on a MMAP IO return devices.getDeviceFromId( desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId()); } else { auto activeClientsWithRoute = desc->clientsList(true /*activeOnly*/, filter, true /*preferredDevice*/); active = activeClients.size() > 0; if (active && activeClients.size() == activeClientsWithRoute.size()) { if (activeClients.size() == activeClientsWithRoute.size()) { return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId()); } } } return nullptr; } Loading services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h +9 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,15 @@ public: (mFlags & (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)); } inline bool isMmap() const { return (asAudioPort()->getType() == AUDIO_PORT_TYPE_MIX) && (((asAudioPort()->getRole() == AUDIO_PORT_ROLE_SOURCE) && ((mFlags & AUDIO_OUTPUT_FLAG_MMAP_NOIRQ) != 0)) || ((asAudioPort()->getRole() == AUDIO_PORT_ROLE_SINK) && ((mFlags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0))); } void addRoute(const sp<AudioRoute> &route) { mRoutes.add(route); } const AudioRouteVector &getRoutes() const { return mRoutes; } Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -2405,9 +2405,7 @@ void AudioPolicyManager::checkCloseInputs() { for (size_t i = 0; i < mInputs.size(); i++) { const sp<AudioInputDescriptor> input = mInputs.valueAt(i); if (input->clientsList().size() == 0 || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices()) || (input->getPolicyAudioPort()->getFlags() & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) { || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())) { inputsToClose.push_back(mInputs.keyAt(i)); } else { bool close = false; Loading Loading
services/audiopolicy/common/managerdefinitions/include/AudioIODescriptorInterface.h +17 −4 Original line number Diff line number Diff line Loading @@ -41,12 +41,25 @@ sp<DeviceDescriptor> findPreferredDevice( IoDescriptor& desc, Filter filter, bool& active, const DeviceVector& devices) { auto activeClients = desc->clientsList(true /*activeOnly*/); active = activeClients.size() > 0; if (active) { // On MMAP IOs, the preferred device is selected by the first client (virtual client // created when the mmap stream is opened). This client is never active. // On non MMAP IOs, the preferred device is honored only if all active clients have // a preferred device in which case the first client drives the selection. if (desc->getPolicyAudioPort()->isMmap()) { // The client list is never empty on a MMAP IO return devices.getDeviceFromId( desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId()); } else { auto activeClientsWithRoute = desc->clientsList(true /*activeOnly*/, filter, true /*preferredDevice*/); active = activeClients.size() > 0; if (active && activeClients.size() == activeClientsWithRoute.size()) { if (activeClients.size() == activeClientsWithRoute.size()) { return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId()); } } } return nullptr; } Loading
services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h +9 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,15 @@ public: (mFlags & (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)); } inline bool isMmap() const { return (asAudioPort()->getType() == AUDIO_PORT_TYPE_MIX) && (((asAudioPort()->getRole() == AUDIO_PORT_ROLE_SOURCE) && ((mFlags & AUDIO_OUTPUT_FLAG_MMAP_NOIRQ) != 0)) || ((asAudioPort()->getRole() == AUDIO_PORT_ROLE_SINK) && ((mFlags & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0))); } void addRoute(const sp<AudioRoute> &route) { mRoutes.add(route); } const AudioRouteVector &getRoutes() const { return mRoutes; } Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -2405,9 +2405,7 @@ void AudioPolicyManager::checkCloseInputs() { for (size_t i = 0; i < mInputs.size(); i++) { const sp<AudioInputDescriptor> input = mInputs.valueAt(i); if (input->clientsList().size() == 0 || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices()) || (input->getPolicyAudioPort()->getFlags() & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) { || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())) { inputsToClose.push_back(mInputs.keyAt(i)); } else { bool close = false; Loading