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

Commit 68326fe0 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Use -Werror in frameworks/av/media/libaaudio

* Remove unused local variables, labels, functions, private fields.
* Fix warning of unused return result.
* Use template functions in .h file to avoid warning of unused static functions.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I54962a7fd36a405e54366130b9c0a24e26fe8ebb
parent 333d2501
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ LOCAL_C_INCLUDES := \

# NDK recommends using this kind of relative path instead of an absolute path.
LOCAL_SRC_FILES:= ../src/input_monitor.cpp
LOCAL_CFLAGS := -Wall -Werror
LOCAL_SHARED_LIBRARIES := libaaudio
LOCAL_MODULE := input_monitor
include $(BUILD_EXECUTABLE)
@@ -22,6 +23,7 @@ LOCAL_C_INCLUDES := \
    frameworks/av/media/libaaudio/examples/utils

LOCAL_SRC_FILES:= ../src/input_monitor_callback.cpp
LOCAL_CFLAGS := -Wall -Werror
LOCAL_SHARED_LIBRARIES := libaaudio
LOCAL_MODULE := input_monitor_callback
include $(BUILD_EXECUTABLE)
+0 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ int main(int argc, const char **argv)
    int actualSamplesPerFrame;
    int actualSampleRate;
    aaudio_format_t       actualDataFormat;
    aaudio_sharing_mode_t actualSharingMode;

    AAudioStream *aaudioStream = nullptr;
    aaudio_stream_state_t state;
@@ -54,7 +53,6 @@ int main(int argc, const char **argv)
    int64_t previousFramePosition = -1;
    int16_t *data = nullptr;
    float peakLevel = 0.0;
    int loopCounter = 0;
    int32_t deviceId;

    // Make printf print immediately so that debug info is not stuck
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ LOCAL_C_INCLUDES := \

# NDK recommends using this kind of relative path instead of an absolute path.
LOCAL_SRC_FILES:= ../src/loopback.cpp
LOCAL_CFLAGS := -Wall -Werror
LOCAL_SHARED_LIBRARIES := libaaudio
LOCAL_MODULE := aaudio_loopback
include $(BUILD_EXECUTABLE)
+1 −7
Original line number Diff line number Diff line
@@ -432,9 +432,7 @@ public:
            int needleSize = (int) (sizeof(s_Impulse) / sizeof(float));
            float *haystack = audioRecorder.getData();
            int haystackSize = audioRecorder.size();
            int result = measureLatencyFromEchos(haystack, haystackSize,
                                                 needle, needleSize,
                                                 &latencyReport);
            measureLatencyFromEchos(haystack, haystackSize, needle, needleSize, &latencyReport);
            if (latencyReport.confidence < 0.01) {
                printf("   ERROR - confidence too low = %f\n", latencyReport.confidence);
            } else {
@@ -580,7 +578,6 @@ private:

    int           mDownCounter = 500;
    int           mLoopCounter = 0;
    int           mLoopStart = 1000;
    float         mPulseThreshold = 0.02f;
    float         mSilenceThreshold = 0.002f;
    float         mMeasuredLoopGain = 0.0f;
@@ -651,7 +648,6 @@ public:
    void process(float *inputData, int inputChannelCount,
                 float *outputData, int outputChannelCount,
                 int numFrames) override {
        float sample;
        float peak = measurePeakAmplitude(inputData, inputChannelCount, numFrames);
        if (peak > mPeakAmplitude) {
            mPeakAmplitude = peak;
@@ -779,8 +775,6 @@ private:
    int32_t mFrameCounter = 0;
    float   mOutputAmplitude = 0.75;

    int32_t mZeroCrossings = 0;

    PseudoRandom  mWhiteNoise;
    float   mNoiseAmplitude = 0.00; // Used to experiment with warbling caused by DRC.

+0 −7
Original line number Diff line number Diff line
@@ -257,24 +257,17 @@ int main(int argc, const char **argv)
    aaudio_result_t      result = AAUDIO_OK;
    aaudio_sharing_mode_t requestedInputSharingMode     = AAUDIO_SHARING_MODE_SHARED;
    int                   requestedInputChannelCount = NUM_INPUT_CHANNELS;
    const int             requestedOutputChannelCount = AAUDIO_UNSPECIFIED;
    int                   actualSampleRate = 0;
    const aaudio_format_t requestedInputFormat = AAUDIO_FORMAT_PCM_I16;
    const aaudio_format_t requestedOutputFormat = AAUDIO_FORMAT_PCM_FLOAT;
    aaudio_format_t       actualInputFormat;
    aaudio_format_t       actualOutputFormat;
    aaudio_performance_mode_t outputPerformanceLevel = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;
    aaudio_performance_mode_t inputPerformanceLevel = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;

    int testMode = TEST_ECHO_LATENCY;
    double gain = 1.0;

    aaudio_stream_state_t state = AAUDIO_STREAM_STATE_UNINITIALIZED;
    int32_t framesPerBurst = 0;
    float *outputData = NULL;
    double deviation;
    double latency;
    int32_t burstsPerBuffer = 1; // single buffered

    // Make printf print immediately so that debug info is not stuck
    // in a buffer if we hang or crash.
Loading