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

Commit 76b54c05 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audioflinger: Fix RefBase "exception" issue from FastThread"

parents 99e9db75 01d09d9e
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -66,8 +66,8 @@ FastThread::FastThread(const char *cycleMs, const char *loadUs) : Thread(false /
    /* mMeasuredWarmupTs({0, 0}), */
    /* mMeasuredWarmupTs({0, 0}), */
    mWarmupCycles(0),
    mWarmupCycles(0),
    mWarmupConsecutiveInRangeCycles(0),
    mWarmupConsecutiveInRangeCycles(0),
    // mDummyNBLogWriter
    mDummyNBLogWriter(new NBLog::Writer()),
    mNBLogWriter(&mDummyNBLogWriter),
    mNBLogWriter(mDummyNBLogWriter.get()),
    mTimestampStatus(INVALID_OPERATION),
    mTimestampStatus(INVALID_OPERATION),


    mCommand(FastThreadState::INITIAL),
    mCommand(FastThreadState::INITIAL),
@@ -94,7 +94,7 @@ bool FastThread::threadLoop()
{
{
    // LOGT now works even if tlNBLogWriter is nullptr, but we're considering changing that,
    // LOGT now works even if tlNBLogWriter is nullptr, but we're considering changing that,
    // so this initialization permits a future change to remove the check for nullptr.
    // so this initialization permits a future change to remove the check for nullptr.
    tlNBLogWriter = &mDummyNBLogWriter;
    tlNBLogWriter = mDummyNBLogWriter.get();
    for (;;) {
    for (;;) {


        // either nanosleep, sched_yield, or busy wait
        // either nanosleep, sched_yield, or busy wait
@@ -124,7 +124,8 @@ bool FastThread::threadLoop()


            // As soon as possible of learning of a new dump area, start using it
            // As soon as possible of learning of a new dump area, start using it
            mDumpState = next->mDumpState != NULL ? next->mDumpState : mDummyDumpState;
            mDumpState = next->mDumpState != NULL ? next->mDumpState : mDummyDumpState;
            mNBLogWriter = next->mNBLogWriter != NULL ? next->mNBLogWriter : &mDummyNBLogWriter;
            mNBLogWriter = next->mNBLogWriter != NULL ?
                    next->mNBLogWriter : mDummyNBLogWriter.get();
            setNBLogWriter(mNBLogWriter);   // FastMixer informs its AudioMixer, FastCapture ignores
            setNBLogWriter(mNBLogWriter);   // FastMixer informs its AudioMixer, FastCapture ignores
            tlNBLogWriter = mNBLogWriter;
            tlNBLogWriter = mNBLogWriter;


+7 −6
Original line number Original line Diff line number Diff line
@@ -81,8 +81,9 @@ protected:
    struct timespec   mMeasuredWarmupTs;  // how long did it take for warmup to complete
    struct timespec   mMeasuredWarmupTs;  // how long did it take for warmup to complete
    uint32_t          mWarmupCycles;  // counter of number of loop cycles during warmup phase
    uint32_t          mWarmupCycles;  // counter of number of loop cycles during warmup phase
    uint32_t          mWarmupConsecutiveInRangeCycles;    // number of consecutive cycles in range
    uint32_t          mWarmupConsecutiveInRangeCycles;    // number of consecutive cycles in range
    NBLog::Writer   mDummyNBLogWriter;
    sp<NBLog::Writer> mDummyNBLogWriter;
    NBLog::Writer*  mNBLogWriter;   // always non-nullptr: real NBLog::Writer* or &mDummyNBLogWriter
    NBLog::Writer*    mNBLogWriter;   // always non-nullptr: real NBLog::Writer* or
                                      // mDummyNBLogWriter.get()
    status_t          mTimestampStatus;
    status_t          mTimestampStatus;


    FastThreadState::Command mCommand;
    FastThreadState::Command mCommand;