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

Commit 6e9f0e45 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "audio: ensure effect chain with specific session id is unique"

parents bb85a77f 9aeb1770
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3277,11 +3277,15 @@ sp<IEffect> AudioFlinger::createEffect(
            }
            // look for the thread where the specified audio session is present
            for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
                if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
                uint32_t sessionType = mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId);
                if (sessionType != 0) {
                    io = mPlaybackThreads.keyAt(i);
                    // thread with same effect session is preferable
                    if ((sessionType & ThreadBase::EFFECT_SESSION) != 0) {
                        break;
                    }
                }
            }
            if (io == AUDIO_IO_HANDLE_NONE) {
                for (size_t i = 0; i < mRecordThreads.size(); i++) {
                    if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {