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

Commit 20d16a8a authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am 3bcffa13: force command flush after releasing a reference to shared memory

* commit '3bcffa13':
  force command flush after releasing a reference to shared memory
parents 0d1004ad 3bcffa13
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -105,6 +105,8 @@ AudioRecord::~AudioRecord()
        }
        }
        mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this);
        mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this);
        mAudioRecord.clear();
        mAudioRecord.clear();
        mCblkMemory.clear();
        mBufferMemory.clear();
        IPCThreadState::self()->flushCommands();
        IPCThreadState::self()->flushCommands();
        AudioSystem::releaseAudioSessionId(mSessionId, -1);
        AudioSystem::releaseAudioSessionId(mSessionId, -1);
    }
    }
@@ -546,9 +548,10 @@ status_t AudioRecord::openRecord_l(size_t epoch)
        mDeathNotifier.clear();
        mDeathNotifier.clear();
    }
    }
    mAudioRecord = record;
    mAudioRecord = record;

    mCblkMemory = iMem;
    mCblkMemory = iMem;
    mBufferMemory = bufferMem;
    mBufferMemory = bufferMem;
    IPCThreadState::self()->flushCommands();

    mCblk = cblk;
    mCblk = cblk;
    // note that temp is the (possibly revised) value of frameCount
    // note that temp is the (possibly revised) value of frameCount
    if (temp < frameCount || (frameCount == 0 && temp == 0)) {
    if (temp < frameCount || (frameCount == 0 && temp == 0)) {
+4 −1
Original line number Original line Diff line number Diff line
@@ -174,6 +174,8 @@ AudioTrack::~AudioTrack()
        }
        }
        mAudioTrack->asBinder()->unlinkToDeath(mDeathNotifier, this);
        mAudioTrack->asBinder()->unlinkToDeath(mDeathNotifier, this);
        mAudioTrack.clear();
        mAudioTrack.clear();
        mCblkMemory.clear();
        mSharedBuffer.clear();
        IPCThreadState::self()->flushCommands();
        IPCThreadState::self()->flushCommands();
        ALOGV("~AudioTrack, releasing session id from %d on behalf of %d",
        ALOGV("~AudioTrack, releasing session id from %d on behalf of %d",
                IPCThreadState::self()->getCallingPid(), mClientPid);
                IPCThreadState::self()->getCallingPid(), mClientPid);
@@ -1059,8 +1061,9 @@ status_t AudioTrack::createTrack_l(size_t epoch)
        mDeathNotifier.clear();
        mDeathNotifier.clear();
    }
    }
    mAudioTrack = track;
    mAudioTrack = track;

    mCblkMemory = iMem;
    mCblkMemory = iMem;
    IPCThreadState::self()->flushCommands();

    audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMemPointer);
    audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMemPointer);
    mCblk = cblk;
    mCblk = cblk;
    // note that temp is the (possibly revised) value of frameCount
    // note that temp is the (possibly revised) value of frameCount
+2 −2
Original line number Original line Diff line number Diff line
@@ -223,6 +223,8 @@ AudioFlinger::ThreadBase::TrackBase::~TrackBase()
        // relying on the automatic clear() at end of scope.
        // relying on the automatic clear() at end of scope.
        mClient.clear();
        mClient.clear();
    }
    }
    // flush the binder command buffer
    IPCThreadState::self()->flushCommands();
}
}


// AudioBufferProvider interface
// AudioBufferProvider interface
@@ -432,8 +434,6 @@ AudioFlinger::PlaybackThread::Track::~Track()
    // This prevents that leak.
    // This prevents that leak.
    if (mSharedBuffer != 0) {
    if (mSharedBuffer != 0) {
        mSharedBuffer.clear();
        mSharedBuffer.clear();
        // flush the binder command buffer
        IPCThreadState::self()->flushCommands();
    }
    }
}
}