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

Commit 75270309 authored by Andy Hung's avatar Andy Hung Committed by Gerrit Code Review
Browse files

Merge "Code clean for audioflinger"

parents d546de4c 537412fa
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -4585,12 +4585,9 @@ bool AudioFlinger::updateOrphanEffectChains(const sp<AudioFlinger::EffectModule>
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------


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

    // make sure transactions reserved to AudioPolicyManager do not come from other processes
    // make sure transactions reserved to AudioPolicyManager do not come from other processes
    switch (code) {
    switch (code) {
        case TransactionCode::SET_STREAM_VOLUME:
        case TransactionCode::SET_STREAM_VOLUME:
+0 −2
Original line number Original line Diff line number Diff line
@@ -79,8 +79,6 @@ FastMixer::FastMixer(audio_io_handle_t parentIoHandle)
    mMasterMono(false),
    mMasterMono(false),
    mThreadIoHandle(parentIoHandle)
    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
    // FIXME pass sInitial as parameter to base class constructor, and make it static local
    mPrevious = &sInitial;
    mPrevious = &sInitial;
    mCurrent = &sInitial;
    mCurrent = &sInitial;
+2 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,8 @@ private:
    std::atomic<float> mMasterBalance{};
    std::atomic<float> mMasterBalance{};
    std::atomic_int_fast64_t mBoottimeOffset;
    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
#ifdef TEE_SINK
    NBAIO_Tee       mTee;
    NBAIO_Tee       mTee;
#endif
#endif
+6 −7
Original line number Original line Diff line number Diff line
@@ -3293,7 +3293,7 @@ bool AudioFlinger::PlaybackThread::isValidSyncEvent(const sp<SyncEvent>& event)
}
}


void AudioFlinger::PlaybackThread::threadLoop_removeTracks(
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,
    // Miscellaneous track cleanup when removed from the active list,
    // called without Thread lock but synchronized with threadLoop processing.
    // called without Thread lock but synchronized with threadLoop processing.
@@ -3304,8 +3304,6 @@ void AudioFlinger::PlaybackThread::threadLoop_removeTracks(
            addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
            addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
        }
        }
    }
    }
#else
    (void)tracksToRemove; // suppress unused warning
#endif
#endif
}
}


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


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