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

Commit a2ab4505 authored by Eric Laurent's avatar Eric Laurent Committed by Glenn Kasten
Browse files

audio flinger: force audio path start from normal mixer

The audio HAL wakes up and configures the audio path when receiving
the first write() in standby state. This causes a certain amount of
process to take place in the mixer threads which is problematic for
fast mixer running at FIFO priority.

We now force a fake write() of 0 bytes from normal mixer to trigger
the audio path configuration before starting the fast mixer.

Bug: 23791972.

Change-Id: I54311b337fda956444846f5d2f53a3263d54e04b
parent 0f050315
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3479,6 +3479,12 @@ ssize_t AudioFlinger::MixerThread::threadLoop_write()
        if (state->mCommand != FastMixerState::MIX_WRITE &&
                (kUseFastMixer != FastMixer_Dynamic || state->mTrackMask > 1)) {
            if (state->mCommand == FastMixerState::COLD_IDLE) {

                // FIXME workaround for first HAL write being CPU bound on some devices
                ATRACE_BEGIN("write");
                mOutput->write((char *)mSinkBuffer, 0);
                ATRACE_END();

                int32_t old = android_atomic_inc(&mFastMixerFutex);
                if (old == -1) {
                    (void) syscall(__NR_futex, &mFastMixerFutex, FUTEX_WAKE_PRIVATE, 1);