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

Commit 8bb6b7e4 authored by Zhou Song's avatar Zhou Song Committed by Steve Kondik
Browse files

audioflinger: decline track to be offloaded if there's active one

-If multiple offload tracks are activated at the same time,
 status of the tracks can be affected by each other and results
 in unexpected behavior
-Deny subsequent track to be offloaded and fall back to sw decoder
 if there's already actived one

Change-Id: Idaa9213d54b9bcdd0e5c25c1dec516d994ae006f
CRs-Fixed: 704382
parent b3d326de
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -605,6 +605,16 @@ sp<IAudioTrack> AudioFlinger::createTrack(
            goto Exit;
            goto Exit;
        }
        }


        {
            Mutex::Autolock _l(thread->mLock);
            // avoid two active tracks added to offload thread
            if (thread->mType == PlaybackThread::OFFLOAD && (thread->mActiveTracks.size() > 0)) {
                ALOGD("decline track creation for offload as an active track already exsits");
                lStatus = BAD_VALUE;
                goto Exit;
            }
        }

        pid_t pid = IPCThreadState::self()->getCallingPid();
        pid_t pid = IPCThreadState::self()->getCallingPid();
        client = registerPid(pid);
        client = registerPid(pid);