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

Commit 537412fa authored by Jing Mike's avatar Jing Mike
Browse files

Code clean for audioflinger



Cleaning compile warnings:
1. For "variable 'XX' set but not used":
   Remove the variables which are obviously not used;
   Add "[[maybe_unused]]" to variable declaration of the ones
       which are potentially used.
2. For "unused parameter 'XX'":
   Add "[[maybe_unused]]" to the unused function parameters.

Test: mmm frameworks/av/services/audioflinger, presubmit check.

Change-Id: I6bd6fa9a57de93f5387e1ad76342f0a0b0ac28ed
Signed-off-by: default avatarJing Mike <jingyangliu@eswincomputing.com>
parent 04f11bab
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -4585,12 +4585,9 @@ bool AudioFlinger::updateOrphanEffectChains(const sp<AudioFlinger::EffectModule>
// ----------------------------------------------------------------------------

status_t AudioFlinger::onTransactWrapper(TransactionCode code,
                                         const Parcel& data,
                                         uint32_t flags,
                                         [[maybe_unused]] const Parcel& data,
                                         [[maybe_unused]] uint32_t flags,
                                         const std::function<status_t()>& delegate) {
    (void) data;
    (void) flags;

    // make sure transactions reserved to AudioPolicyManager do not come from other processes
    switch (code) {
        case TransactionCode::SET_STREAM_VOLUME:
+0 −2
Original line number Diff line number Diff line
@@ -79,8 +79,6 @@ FastMixer::FastMixer(audio_io_handle_t parentIoHandle)
    mMasterMono(false),
    mThreadIoHandle(parentIoHandle)
{
    (void)mThreadIoHandle; // prevent unused warning, see C++17 [[maybe_unused]]

    // FIXME pass sInitial as parameter to base class constructor, and make it static local
    mPrevious = &sInitial;
    mCurrent = &sInitial;
+2 −1
Original line number Diff line number Diff line
@@ -107,7 +107,8 @@ private:
    std::atomic<float> mMasterBalance{};
    std::atomic_int_fast64_t mBoottimeOffset;

    const audio_io_handle_t mThreadIoHandle; // parent thread id for debugging purposes
    // parent thread id for debugging purposes
    [[maybe_unused]] const audio_io_handle_t mThreadIoHandle;
#ifdef TEE_SINK
    NBAIO_Tee       mTee;
#endif
+6 −7
Original line number Diff line number Diff line
@@ -3293,7 +3293,7 @@ bool AudioFlinger::PlaybackThread::isValidSyncEvent(const sp<SyncEvent>& event)
}

void AudioFlinger::PlaybackThread::threadLoop_removeTracks(
        const Vector< sp<Track> >& tracksToRemove)
        [[maybe_unused]] const Vector< sp<Track> >& tracksToRemove)
{
    // Miscellaneous track cleanup when removed from the active list,
    // called without Thread lock but synchronized with threadLoop processing.
@@ -3304,8 +3304,6 @@ void AudioFlinger::PlaybackThread::threadLoop_removeTracks(
            addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
        }
    }
#else
    (void)tracksToRemove; // suppress unused warning
#endif
}

@@ -5829,7 +5827,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
    }

    // Push the new FastMixer state if necessary
    bool pauseAudioWatchdog = false;
    [[maybe_unused]] bool pauseAudioWatchdog = false;
    if (didModify) {
        state->mFastTracksGen++;
        // if the fast mixer was active, but now there are no fast tracks, then put it in cold idle
@@ -7570,7 +7568,7 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger,
    size_t numCounterOffers = 0;
    const NBAIO_Format offers[1] = {Format_from_SR_C(mSampleRate, mChannelCount, mFormat)};
#if !LOG_NDEBUG
    ssize_t index =
    [[maybe_unused]] ssize_t index =
#else
    (void)
#endif
@@ -7621,7 +7619,7 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger,
        Pipe *pipe = new Pipe(pipeFramesP2, format, pipeBuffer);
        const NBAIO_Format offers[1] = {format};
        size_t numCounterOffers = 0;
        ssize_t index = pipe->negotiate(offers, 1, NULL, numCounterOffers);
        [[maybe_unused]] ssize_t index = pipe->negotiate(offers, 1, NULL, numCounterOffers);
        ALOG_ASSERT(index == 0);
        mPipeSink = pipe;
        PipeReader *pipeReader = new PipeReader(*pipe);
@@ -9077,7 +9075,8 @@ bool AudioFlinger::RecordThread::checkForNewParameter_l(const String8& keyValueP
    audio_format_t reqFormat = mFormat;
    uint32_t samplingRate = mSampleRate;
    // TODO this may change if we want to support capture from HDMI PCM multi channel (e.g on TVs).
    audio_channel_mask_t channelMask = audio_channel_in_mask_from_count(mChannelCount);
    [[maybe_unused]] audio_channel_mask_t channelMask =
                                audio_channel_in_mask_from_count(mChannelCount);

    AudioParameter param = AudioParameter(keyValuePair);
    int value;