FastPath: More clang-tidy optimizations
use-default-member-init
Test: ALLOW_LOCAL_TIDY_TRUE=1 mm -j .
Test: atest AudioTrackTest AudioRecordTest
Bug: 284390461
Merged-In: I4b5570bcbe3d4c3df890d87f547bab1de3c62187
Change-Id: I4b5570bcbe3d4c3df890d87f547bab1de3c62187
(cherry picked from commit 87e740a67f3ebac577635cd321ba7a88c65d1f0f)
diff --git a/services/audioflinger/fastpath/FastMixerState.h b/services/audioflinger/fastpath/FastMixerState.h
index f40f612..fdf3eaa 100644
--- a/services/audioflinger/fastpath/FastMixerState.h
+++ b/services/audioflinger/fastpath/FastMixerState.h
@@ -43,13 +43,16 @@
// Represents the state of a fast track
struct FastTrack {
- FastTrack();
+ // must be nullptr if inactive, or non-nullptr if active
+ ExtendedAudioBufferProvider* mBufferProvider = nullptr;
- ExtendedAudioBufferProvider* mBufferProvider; // must be NULL if inactive, or non-NULL if active
- VolumeProvider* mVolumeProvider; // optional; if NULL then full-scale
- audio_channel_mask_t mChannelMask; // AUDIO_CHANNEL_OUT_MONO or AUDIO_CHANNEL_OUT_STEREO
- audio_format_t mFormat; // track format
- int mGeneration; // increment when any field is assigned
+ // optional: if nullptr then full-scale
+ VolumeProvider* mVolumeProvider = nullptr;
+
+ // AUDIO_CHANNEL_OUT_MONO or AUDIO_CHANNEL_OUT_STEREO
+ audio_channel_mask_t mChannelMask = AUDIO_CHANNEL_OUT_STEREO;
+ audio_format_t mFormat = AUDIO_FORMAT_INVALID; // track format
+ int mGeneration = 0; // increment when any field is assigned
bool mHapticPlaybackEnabled = false; // haptic playback is enabled or not
os::HapticScale mHapticIntensity = os::HapticScale::MUTE; // intensity of haptic data
float mHapticMaxAmplitude = NAN; // max amplitude allowed for haptic data
@@ -72,11 +75,12 @@
// all pointer fields use raw pointers; objects are owned and ref-counted by the normal mixer
FastTrack mFastTracks[kMaxFastTracks];
- int mFastTracksGen; // increment when any mFastTracks[i].mGeneration is incremented
- unsigned mTrackMask; // bit i is set if and only if mFastTracks[i] is active
- NBAIO_Sink* mOutputSink; // HAL output device, must already be negotiated
- int mOutputSinkGen; // increment when mOutputSink is assigned
- size_t mFrameCount; // number of frames per fast mix buffer
+ int mFastTracksGen = 0; // increment when any
+ // mFastTracks[i].mGeneration is incremented
+ unsigned mTrackMask = 0; // bit i is set if and only if mFastTracks[i] is active
+ NBAIO_Sink* mOutputSink = nullptr; // HAL output device, must already be negotiated
+ int mOutputSinkGen = 0; // increment when mOutputSink is assigned
+ size_t mFrameCount = 0; // number of frames per fast mix buffer
audio_channel_mask_t mSinkChannelMask; // If not AUDIO_CHANNEL_NONE, specifies sink channel
// mask when it cannot be directly calculated from
// channel count