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

Commit 3ef14ef3 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Make error handling more similar for output and capture

And simplify error case

Change-Id: I0bb1ec252945d672cc4cef137977b912f1b23d51
parent 15e57989
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -622,15 +622,17 @@ sp<IAudioTrack> AudioFlinger::createTrack(

    }

    if (lStatus == NO_ERROR) {
        trackHandle = new TrackHandle(track);
    } else {
        // remove local strong reference to Client before deleting the Track so that the Client
        // destructor is called by the TrackBase destructor with mLock held
    if (lStatus != NO_ERROR) {
        // remove local strong reference to Client before deleting the Track so that the
        // Client destructor is called by the TrackBase destructor with mLock held
        client.clear();
        track.clear();
        goto Exit;
    }

    // return handle to client
    trackHandle = new TrackHandle(track);

Exit:
    *status = lStatus;
    return trackHandle;
+36 −35
Original line number Diff line number Diff line
@@ -350,7 +350,10 @@ AudioFlinger::PlaybackThread::Track::Track(
    mResumeToStopping(false),
    mFlushHwPending(false)
{
    if (mCblk != NULL) {
    if (mCblk == NULL) {
        return;
    }

    if (sharedBuffer == 0) {
        mAudioTrackServerProxy = new AudioTrackServerProxy(mCblk, mBuffer, frameCount,
                mFrameSize);
@@ -359,7 +362,7 @@ AudioFlinger::PlaybackThread::Track::Track(
                mFrameSize);
    }
    mServerProxy = mAudioTrackServerProxy;
        // to avoid leaking a track name, do not allocate one unless there is an mCblk

    mName = thread->getTrackName_l(channelMask, sessionId);
    if (mName < 0) {
        ALOGE("no more track names available");
@@ -381,9 +384,6 @@ AudioFlinger::PlaybackThread::Track::Track(
        thread->mFastTrackAvailMask &= ~(1 << i);
    }
}
    ALOGV("Track constructor name %d, calling pid %d", mName,
            IPCThreadState::self()->getCallingPid());
}

AudioFlinger::PlaybackThread::Track::~Track()
{
@@ -1789,11 +1789,12 @@ AudioFlinger::RecordThread::RecordTrack::RecordTrack(
        // See real initialization of mRsmpInFront at RecordThread::start()
        mRsmpInUnrel(0), mRsmpInFront(0), mFramesToDrop(0), mResamplerBufferProvider(NULL)
{
    ALOGV("RecordTrack constructor");
    if (mCblk != NULL) {
        mServerProxy = new AudioRecordServerProxy(mCblk, mBuffer, frameCount, mFrameSize);
    if (mCblk == NULL) {
        return;
    }

    mServerProxy = new AudioRecordServerProxy(mCblk, mBuffer, frameCount, mFrameSize);

    uint32_t channelCount = popcount(channelMask);
    // FIXME I don't understand either of the channel count checks
    if (thread->mSampleRate != sampleRate && thread->mChannelCount <= FCC_2 &&