Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7c50104 authored by Eric Laurent's avatar Eric Laurent
Browse files

resolve merge conflicts of a3de77f1 to master

Change-Id: Idb3346465ee7f47d95fd24e2dafdd66f3759c1be
parents 00c553db a3de77f1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -95,7 +95,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
+4 −2
Original line number Diff line number Diff line
@@ -241,12 +241,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++;
        }
    }
+14 −5
Original line number Diff line number Diff line
@@ -1727,7 +1727,7 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
    if (isInCall()) {
        *concurrency |= API_INPUT_CONCURRENCY_CALL;
    }
    if (mInputs.activeInputsCount() != 0) {
    if (mInputs.activeInputsCountOnDevices() != 0) {
        *concurrency |= API_INPUT_CONCURRENCY_CAPTURE;
    }

@@ -1739,8 +1739,10 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
    mInputRoutes.incRouteActivity(session);

    if (audioSession->activeCount() == 1 || mInputRoutes.hasRouteChanged(session)) {

        setInputDevice(input, getNewInputDevice(inputDesc), true /* force */);
        // indicate active capture to sound trigger service if starting capture from a mic on
        // primary HW module
        audio_devices_t device = getNewInputDevice(inputDesc);
        setInputDevice(input, device, true /* force */);

        if (inputDesc->getAudioSessionCount(true/*activeOnly*/) == 1) {
            // if input maps to a dynamic policy with an activity listener, notify of state change
@@ -1750,7 +1752,9 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
                        MIX_STATE_MIXING);
            }

            if (mInputs.activeInputsCount() == 0) {
            audio_devices_t primaryInputDevices = availablePrimaryInputDevices();
            if (((device & primaryInputDevices & ~AUDIO_DEVICE_BIT_IN) != 0) &&
                    mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) {
                SoundTrigger::setCaptureState(true);
            }

@@ -1833,9 +1837,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();