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

Commit 21e81bca authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Android Git Automerger
Browse files

am e010f65e: audioflinger: Fix for a deadlock in track creation

* commit 'e010f65e':
  audioflinger: Fix for a deadlock in track creation
parents 57159656 e010f65e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -513,6 +513,8 @@ sp<IAudioTrack> AudioFlinger::createTrack(

        track = thread->createTrack_l(client, streamType, sampleRate, format,
                channelMask, frameCount, sharedBuffer, lSessionId, flags, tid, clientUid, &lStatus);
        LOG_ALWAYS_FATAL_IF((lStatus == NO_ERROR) && (track == 0));
        // we don't abort yet if lStatus != NO_ERROR; there is still work to be done regardless

        // move effect chain to this output thread if an effect on same session was waiting
        // for a track to be created
@@ -1291,7 +1293,7 @@ sp<IAudioRecord> AudioFlinger::openRecord(
                                                  frameCount, lSessionId,
                                                  IPCThreadState::self()->getCallingUid(),
                                                  flags, tid, &lStatus);
        LOG_ALWAYS_FATAL_IF((recordTrack != 0) != (lStatus == NO_ERROR));
        LOG_ALWAYS_FATAL_IF((lStatus == NO_ERROR) && (recordTrack == 0));
    }
    if (lStatus != NO_ERROR) {
        // remove local strong reference to Client before deleting the RecordTrack so that the
+3 −1
Original line number Diff line number Diff line
@@ -1326,8 +1326,10 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
            track = TimedTrack::create(this, client, streamType, sampleRate, format,
                    channelMask, frameCount, sharedBuffer, sessionId, uid);
        }

        if (track == 0 || track->getCblk() == NULL || track->name() < 0) {
            lStatus = NO_MEMORY;
            // track must be cleared from the caller as the caller has the AF lock
            goto Exit;
        }

@@ -4747,7 +4749,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR
        if (track->getCblk() == 0) {
            ALOGE("createRecordTrack_l() no control block");
            lStatus = NO_MEMORY;
            track.clear();
            // track must be cleared from the caller as the caller has the AF lock
            goto Exit;
        }
        mTracks.add(track);