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

Commit fb81747f authored by Andy Hung's avatar Andy Hung
Browse files

FastPath: post clang-tidy cleanup

Test: atest AudioTrackTest AudioRecordTest
Bug: 284390461
Change-Id: I2b58bbbab817a1aa8768cc9d1f1fedf1c8035120
parent 87e740a6
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ public:
    // 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 @@ public:
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
+4 −3
Original line number Diff line number Diff line
@@ -80,12 +80,13 @@ private:
                                        // 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 @@ private:
    // 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;
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ private:
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.
+5 −5
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public:
    // 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;
};

@@ -66,9 +66,9 @@ struct FastMixerState : FastThreadState {
    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
+2 −3
Original line number Diff line number Diff line
@@ -123,11 +123,10 @@ struct StateQueueMutatorDump {
#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,