FastPath: post clang-tidy cleanup
Test: atest AudioTrackTest AudioRecordTest
Bug: 284390461
Merged-In: I2b58bbbab817a1aa8768cc9d1f1fedf1c8035120
Change-Id: I2b58bbbab817a1aa8768cc9d1f1fedf1c8035120
(cherry picked from commit fb81747f310bd5578cdd4ab4627e540512491caa)
diff --git a/services/audioflinger/fastpath/AutoPark.h b/services/audioflinger/fastpath/AutoPark.h
index 6e68327..d71a305 100644
--- a/services/audioflinger/fastpath/AutoPark.h
+++ b/services/audioflinger/fastpath/AutoPark.h
@@ -25,7 +25,6 @@
// Park the specific FastThread, which can be nullptr, in hot idle if not currently idling
explicit AutoPark(const sp<T>& fastThread) : mFastThread(fastThread)
{
- mPreviousCommand = FastThreadState::HOT_IDLE;
if (fastThread != nullptr) {
auto sq = mFastThread->sq();
FastThreadState *state = sq->begin();
@@ -57,7 +56,7 @@
private:
const sp<T> mFastThread;
// if !&IDLE, holds the FastThread state to restore after new parameters processed
- FastThreadState::Command mPreviousCommand;
+ FastThreadState::Command mPreviousCommand = FastThreadState::HOT_IDLE;
}; // class AutoPark
} // namespace android
diff --git a/services/audioflinger/fastpath/FastMixer.h b/services/audioflinger/fastpath/FastMixer.h
index 48b94a3..6e48df6 100644
--- a/services/audioflinger/fastpath/FastMixer.h
+++ b/services/audioflinger/fastpath/FastMixer.h
@@ -80,12 +80,13 @@
// if sink format is different than mixer output.
size_t mSinkBufferSize = 0;
uint32_t mSinkChannelCount = FCC_2;
- audio_channel_mask_t mSinkChannelMask;
+ audio_channel_mask_t mSinkChannelMask; // set in ctor
void* mMixerBuffer = nullptr; // mixer output buffer.
size_t mMixerBufferSize = 0;
static constexpr audio_format_t mMixerBufferFormat = AUDIO_FORMAT_PCM_FLOAT;
- uint32_t mAudioChannelCount; // audio channel count, excludes haptic channels.
+ // audio channel count, excludes haptic channels. Set in onStateChange().
+ uint32_t mAudioChannelCount = 0;
enum {UNDEFINED, MIXED, ZEROED} mMixerBufferState = UNDEFINED;
NBAIO_Format mFormat{Format_Invalid};
@@ -103,7 +104,7 @@
// accessed without lock between multiple threads.
std::atomic_bool mMasterMono{};
std::atomic<float> mMasterBalance{};
- std::atomic_int_fast64_t mBoottimeOffset;
+ std::atomic_int_fast64_t mBoottimeOffset{};
// parent thread id for debugging purposes
[[maybe_unused]] const audio_io_handle_t mThreadIoHandle;
diff --git a/services/audioflinger/fastpath/FastMixerDumpState.h b/services/audioflinger/fastpath/FastMixerDumpState.h
index 1b0e029..4d2e1a0 100644
--- a/services/audioflinger/fastpath/FastMixerDumpState.h
+++ b/services/audioflinger/fastpath/FastMixerDumpState.h
@@ -56,7 +56,7 @@
struct FastTrackDump {
FastTrackUnderruns mUnderruns;
size_t mFramesReady = 0; // most recent value only; no long-term statistics kept
- int64_t mFramesWritten; // last value from track
+ int64_t mFramesWritten = 0; // last value from track
};
// No virtuals.
diff --git a/services/audioflinger/fastpath/FastMixerState.h b/services/audioflinger/fastpath/FastMixerState.h
index fdf3eaa..c70e42a 100644
--- a/services/audioflinger/fastpath/FastMixerState.h
+++ b/services/audioflinger/fastpath/FastMixerState.h
@@ -37,7 +37,7 @@
// The provider implementation is responsible for validating that the return value is in range.
virtual gain_minifloat_packed_t getVolumeLR() = 0;
protected:
- VolumeProvider() { }
+ VolumeProvider() = default;
virtual ~VolumeProvider() = default;
};
@@ -63,12 +63,12 @@
// Represents a single state of the fast mixer
struct FastMixerState : FastThreadState {
- FastMixerState();
+ FastMixerState();
// These are the minimum, maximum, and default values for maximum number of fast tracks
- static const unsigned kMinFastTracks = 2;
- static const unsigned kMaxFastTracks = 32;
- static const unsigned kDefaultFastTracks = 8;
+ static constexpr unsigned kMinFastTracks = 2;
+ static constexpr unsigned kMaxFastTracks = 32;
+ static constexpr unsigned kDefaultFastTracks = 8;
static unsigned sMaxFastTracks; // Configured maximum number of fast tracks
static pthread_once_t sMaxFastTracksOnce; // Protects initializer for sMaxFastTracks
diff --git a/services/audioflinger/fastpath/StateQueue.h b/services/audioflinger/fastpath/StateQueue.h
index 29d1809..36d986b 100644
--- a/services/audioflinger/fastpath/StateQueue.h
+++ b/services/audioflinger/fastpath/StateQueue.h
@@ -123,11 +123,10 @@
#endif
// manages a FIFO queue of states
-template<typename T> class StateQueue {
+// marking as final to avoid derived classes as there are no virtuals.
+template<typename T> class StateQueue final {
public:
- virtual ~StateQueue() = default; // why is this virtual?
-
// Observer APIs
// Poll for a state change. Returns a pointer to a read-only state,