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: Jing Mike <jingyangliu@eswincomputing.com>
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index b72348a..37b8fe8 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3293,7 +3293,7 @@
}
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 @@
addBatteryData(IMediaPlayerService::kBatteryDataAudioFlingerStop);
}
}
-#else
- (void)tracksToRemove; // suppress unused warning
#endif
}
@@ -5829,7 +5827,7 @@
}
// 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 @@
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 @@
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 @@
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;