Loading include/media/AudioRecord.h +1 −0 Original line number Diff line number Diff line Loading @@ -474,6 +474,7 @@ private: int mPreviousPriority; // before start() SchedPolicy mPreviousSchedulingGroup; bool mAwaitBoost; // thread should wait for priority boost before running // The proxy should only be referenced while a lock is held because the proxy isn't // multi-thread safe. Loading media/libmedia/AudioRecord.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -662,6 +662,26 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) nsecs_t AudioRecord::processAudioBuffer(const sp<AudioRecordThread>& thread) { mLock.lock(); if (mAwaitBoost) { mAwaitBoost = false; mLock.unlock(); static const int32_t kMaxTries = 5; int32_t tryCounter = kMaxTries; uint32_t pollUs = 10000; do { int policy = sched_getscheduler(0); if (policy == SCHED_FIFO || policy == SCHED_RR) { break; } usleep(pollUs); pollUs <<= 1; } while (tryCounter-- > 0); if (tryCounter < 0) { ALOGE("did not receive expected priority boost on time"); } // Run again immediately return 0; } // Can only reference mCblk while locked int32_t flags = android_atomic_and(~CBLK_OVERRUN, &mCblk->mFlags); Loading Loading
include/media/AudioRecord.h +1 −0 Original line number Diff line number Diff line Loading @@ -474,6 +474,7 @@ private: int mPreviousPriority; // before start() SchedPolicy mPreviousSchedulingGroup; bool mAwaitBoost; // thread should wait for priority boost before running // The proxy should only be referenced while a lock is held because the proxy isn't // multi-thread safe. Loading
media/libmedia/AudioRecord.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -662,6 +662,26 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) nsecs_t AudioRecord::processAudioBuffer(const sp<AudioRecordThread>& thread) { mLock.lock(); if (mAwaitBoost) { mAwaitBoost = false; mLock.unlock(); static const int32_t kMaxTries = 5; int32_t tryCounter = kMaxTries; uint32_t pollUs = 10000; do { int policy = sched_getscheduler(0); if (policy == SCHED_FIFO || policy == SCHED_RR) { break; } usleep(pollUs); pollUs <<= 1; } while (tryCounter-- > 0); if (tryCounter < 0) { ALOGE("did not receive expected priority boost on time"); } // Run again immediately return 0; } // Can only reference mCblk while locked int32_t flags = android_atomic_and(~CBLK_OVERRUN, &mCblk->mFlags); Loading