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

Commit 13f43f4a authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audiohal: Do not log if EINVAL is received from get_presentation_position

This happens often, and it's normal. Avoid logging it down as this
causes logspam.

Bug: 33353073
Change-Id: Ia3b1b8af61bdf83e9bcde0e5bed0285af037df45
Test: cause the system to play some sounds (e.g. UI clicks), watch logcat
parent 2508e0cb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@ Stream::~Stream() {
    mStream = nullptr;
}

Result Stream::analyzeStatus(const char* funcName, int status) {
    if (status != 0) {
Result Stream::analyzeStatus(const char* funcName, int status, int ignoreError) {
    if (status != 0 && status != -ignoreError) {
        ALOGW("Stream %p %s: %s", mStream, funcName, strerror(-status));
    }
    switch (status) {
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ struct Stream : public IStream, public ParametersUtil {
    Return<void> debugDump(const hidl_handle& fd)  override;

    // Utility methods for extending interfaces.
    Result analyzeStatus(const char* funcName, int status);
    Result analyzeStatus(const char* funcName, int status, int ignoreError = OK);

  private:
    audio_stream_t *mStream;
+4 −1
Original line number Diff line number Diff line
@@ -262,7 +262,10 @@ Return<void> StreamOut::getPresentationPosition(getPresentationPosition_cb _hidl
        struct timespec halTimeStamp;
        retval = mStreamCommon->analyzeStatus(
                "get_presentation_position",
                mStream->get_presentation_position(mStream, &frames, &halTimeStamp));
                mStream->get_presentation_position(mStream, &frames, &halTimeStamp),
                // Don't logspam on EINVAL--it's normal for get_presentation_position
                // to return it sometimes.
                EINVAL);
        if (retval == Result::OK) {
            timeStamp.tvSec = halTimeStamp.tv_sec;
            timeStamp.tvNSec = halTimeStamp.tv_nsec;