Loading services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h +3 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,9 @@ public: sp<AudioInputDescriptor> getInputFromId(audio_port_handle_t id) const; uint32_t activeInputsCount() const; // count active capture sessions using one of the specified devices. // ignore devices if AUDIO_DEVICE_IN_DEFAULT is passed uint32_t activeInputsCountOnDevices(audio_devices_t devices = AUDIO_DEVICE_IN_DEFAULT) const; /** * return io handle of active input or 0 if no input is active Loading services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -222,12 +222,14 @@ sp<AudioInputDescriptor> AudioInputCollection::getInputFromId(audio_port_handle_ return inputDesc; } uint32_t AudioInputCollection::activeInputsCount() const uint32_t AudioInputCollection::activeInputsCountOnDevices(audio_devices_t devices) const { uint32_t count = 0; for (size_t i = 0; i < size(); i++) { const sp<AudioInputDescriptor> inputDescriptor = valueAt(i); if (inputDescriptor->isActive()) { if (inputDescriptor->isActive() && ((devices == AUDIO_DEVICE_IN_DEFAULT) || ((inputDescriptor->mDevice & devices & ~AUDIO_DEVICE_BIT_IN) != 0))) { count++; } } Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -1688,10 +1688,15 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input, MIX_STATE_MIXING); } if (mInputs.activeInputsCount() == 0) { // indicate active capture to sound trigger service if starting capture from a mic on // primary HW module audio_devices_t device = getNewInputDevice(input); audio_devices_t primaryInputDevices = availablePrimaryInputDevices(); if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) && mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) { SoundTrigger::setCaptureState(true); } setInputDevice(input, getNewInputDevice(input), true /* force */); setInputDevice(input, device, true /* force */); // automatically enable the remote submix output when input is started if not // used by a policy mix of type MIX_TYPE_RECORDERS Loading Loading @@ -1768,9 +1773,14 @@ status_t AudioPolicyManager::stopInput(audio_io_handle_t input, } } audio_devices_t device = inputDesc->mDevice; resetInputDevice(input); if (mInputs.activeInputsCount() == 0) { // indicate inactive capture to sound trigger service if stopping capture from a mic on // primary HW module audio_devices_t primaryInputDevices = availablePrimaryInputDevices(); if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) && mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) { SoundTrigger::setCaptureState(false); } inputDesc->clearPreemptedSessions(); Loading Loading
services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h +3 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,9 @@ public: sp<AudioInputDescriptor> getInputFromId(audio_port_handle_t id) const; uint32_t activeInputsCount() const; // count active capture sessions using one of the specified devices. // ignore devices if AUDIO_DEVICE_IN_DEFAULT is passed uint32_t activeInputsCountOnDevices(audio_devices_t devices = AUDIO_DEVICE_IN_DEFAULT) const; /** * return io handle of active input or 0 if no input is active Loading
services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -222,12 +222,14 @@ sp<AudioInputDescriptor> AudioInputCollection::getInputFromId(audio_port_handle_ return inputDesc; } uint32_t AudioInputCollection::activeInputsCount() const uint32_t AudioInputCollection::activeInputsCountOnDevices(audio_devices_t devices) const { uint32_t count = 0; for (size_t i = 0; i < size(); i++) { const sp<AudioInputDescriptor> inputDescriptor = valueAt(i); if (inputDescriptor->isActive()) { if (inputDescriptor->isActive() && ((devices == AUDIO_DEVICE_IN_DEFAULT) || ((inputDescriptor->mDevice & devices & ~AUDIO_DEVICE_BIT_IN) != 0))) { count++; } } Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -1688,10 +1688,15 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input, MIX_STATE_MIXING); } if (mInputs.activeInputsCount() == 0) { // indicate active capture to sound trigger service if starting capture from a mic on // primary HW module audio_devices_t device = getNewInputDevice(input); audio_devices_t primaryInputDevices = availablePrimaryInputDevices(); if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) && mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) { SoundTrigger::setCaptureState(true); } setInputDevice(input, getNewInputDevice(input), true /* force */); setInputDevice(input, device, true /* force */); // automatically enable the remote submix output when input is started if not // used by a policy mix of type MIX_TYPE_RECORDERS Loading Loading @@ -1768,9 +1773,14 @@ status_t AudioPolicyManager::stopInput(audio_io_handle_t input, } } audio_devices_t device = inputDesc->mDevice; resetInputDevice(input); if (mInputs.activeInputsCount() == 0) { // indicate inactive capture to sound trigger service if stopping capture from a mic on // primary HW module audio_devices_t primaryInputDevices = availablePrimaryInputDevices(); if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) && mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) { SoundTrigger::setCaptureState(false); } inputDesc->clearPreemptedSessions(); Loading