Loading services/audioflinger/Threads.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -3307,10 +3307,14 @@ bool AudioFlinger::PlaybackThread::threadLoop() // 2. threadLoop_mix (significant for heavy mixing, especially // on low tier processors) // it's OK if deltaMs is an overestimate. const int32_t deltaMs = (lastWriteFinished - previousLastWriteFinished) / 1000000; const int32_t throttleMs = mHalfBufferMs - deltaMs; // it's OK if deltaMs (and deltaNs) is an overestimate. nsecs_t deltaNs; // deltaNs = lastWriteFinished - previousLastWriteFinished; __builtin_sub_overflow( lastWriteFinished,previousLastWriteFinished, &deltaNs); const int32_t deltaMs = deltaNs / 1000000; const int32_t throttleMs = (int32_t)mHalfBufferMs - deltaMs; if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) { usleep(throttleMs * 1000); // notify of throttle start on verbose log Loading services/audioflinger/TypedLogger.h +2 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,8 @@ constexpr uint64_t FNV_prime<uint64_t>() { } template <typename T, size_t n> constexpr T fnv1a(const char (&file)[n], int i = n - 1) { __attribute__((no_sanitize("unsigned-integer-overflow"))) constexpr T fnv1a(const char (&file)[n], ssize_t i = (ssize_t)n - 1) { return i == -1 ? offset_basis<T>() : (fnv1a<T>(file, i - 1) ^ file[i]) * FNV_prime<T>(); } Loading Loading
services/audioflinger/Threads.cpp +8 −4 Original line number Diff line number Diff line Loading @@ -3307,10 +3307,14 @@ bool AudioFlinger::PlaybackThread::threadLoop() // 2. threadLoop_mix (significant for heavy mixing, especially // on low tier processors) // it's OK if deltaMs is an overestimate. const int32_t deltaMs = (lastWriteFinished - previousLastWriteFinished) / 1000000; const int32_t throttleMs = mHalfBufferMs - deltaMs; // it's OK if deltaMs (and deltaNs) is an overestimate. nsecs_t deltaNs; // deltaNs = lastWriteFinished - previousLastWriteFinished; __builtin_sub_overflow( lastWriteFinished,previousLastWriteFinished, &deltaNs); const int32_t deltaMs = deltaNs / 1000000; const int32_t throttleMs = (int32_t)mHalfBufferMs - deltaMs; if ((signed)mHalfBufferMs >= throttleMs && throttleMs > 0) { usleep(throttleMs * 1000); // notify of throttle start on verbose log Loading
services/audioflinger/TypedLogger.h +2 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,8 @@ constexpr uint64_t FNV_prime<uint64_t>() { } template <typename T, size_t n> constexpr T fnv1a(const char (&file)[n], int i = n - 1) { __attribute__((no_sanitize("unsigned-integer-overflow"))) constexpr T fnv1a(const char (&file)[n], ssize_t i = (ssize_t)n - 1) { return i == -1 ? offset_basis<T>() : (fnv1a<T>(file, i - 1) ^ file[i]) * FNV_prime<T>(); } Loading