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

Commit 313d1e7d authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix input device selection

Make sure session activity count is incremented before
selecting device in startInput().

Bug: 26841909
Change-Id: I0b4867b9ad4c7a98e5eddb4f1f23c4cf075f074e
parent 6186b0f4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1638,10 +1638,14 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
        *concurrency |= API_INPUT_CONCURRENCY_CAPTURE;
    }

    // increment activity count before calling getNewInputDevice() below as only active sessions
    // are considered for device selection
    audioSession->changeActiveCount(1);

    // Routing?
    mInputRoutes.incRouteActivity(session);

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

        setInputDevice(input, getNewInputDevice(inputDesc), true /* force */);

@@ -1678,7 +1682,6 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,

    ALOGV("AudioPolicyManager::startInput() input source = %d", audioSession->inputSource());

    audioSession->changeActiveCount(1);
    return NO_ERROR;
}