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

Commit 9d37ea95 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Cleanup error handling in AudioSystem get methods"

parents 0bcfa881 f94006ca
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,8 @@ public:
    static float linearToLog(int volume);
    static int logToLinear(float volume);

    // Returned samplingRate and frameCount output values are guaranteed
    // to be non-zero if status == NO_ERROR
    static status_t getOutputSamplingRate(uint32_t* samplingRate,
            audio_stream_type_t stream);
    static status_t getOutputFrameCount(size_t* frameCount,
+10 −0
Original line number Diff line number Diff line
@@ -259,6 +259,11 @@ status_t AudioSystem::getSamplingRate(audio_io_handle_t output,
        *samplingRate = outputDesc->samplingRate;
        gLock.unlock();
    }
    if (*samplingRate == 0) {
        ALOGE("AudioSystem::getSamplingRate failed for output %d stream type %d",
                output, streamType);
        return BAD_VALUE;
    }

    ALOGV("getSamplingRate() streamType %d, output %d, sampling rate %u", streamType, output,
            *samplingRate);
@@ -299,6 +304,11 @@ status_t AudioSystem::getFrameCount(audio_io_handle_t output,
        *frameCount = outputDesc->frameCount;
        gLock.unlock();
    }
    if (*frameCount == 0) {
        ALOGE("AudioSystem::getFrameCount failed for output %d stream type %d",
                output, streamType);
        return BAD_VALUE;
    }

    ALOGV("getFrameCount() streamType %d, output %d, frameCount %d", streamType, output,
            *frameCount);