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

Commit fb8ede2a authored by Andy Hung's avatar Andy Hung
Browse files

AudioTrack: Add client side track id for logging

Test: Audio sanity test, check logcat
Bug: 115400221
Change-Id: I7c74af8962f7d3b72a7b843df906c54f79f6f009
parent 9d84af54
Loading
Loading
Loading
Loading
+156 −108

File changed.

Preview size limit exceeded, changes collapsed.

+14 −0
Original line number Diff line number Diff line
@@ -1058,6 +1058,19 @@ protected:
        STATE_STOPPING,
    }                       mState;

    static constexpr const char *stateToString(State state)
    {
        switch (state) {
        case STATE_ACTIVE:          return "STATE_ACTIVE";
        case STATE_STOPPED:         return "STATE_STOPPED";
        case STATE_PAUSED:          return "STATE_PAUSED";
        case STATE_PAUSED_STOPPING: return "STATE_PAUSED_STOPPING";
        case STATE_FLUSHED:         return "STATE_FLUSHED";
        case STATE_STOPPING:        return "STATE_STOPPING";
        default:                    return "UNKNOWN";
        }
    }

    // for client callback handler
    callback_t              mCbf;                   // callback handler for events, or NULL
    void*                   mUserData;
@@ -1148,6 +1161,7 @@ protected:

    audio_session_t         mSessionId;
    int                     mAuxEffectId;
    int                     mId;                    // Id from AudioFlinger.

    mutable Mutex           mLock;

+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ public:
            afSampleRate = parcel->readInt64();
            afLatencyMs = parcel->readInt32();
            (void)parcel->read(&outputId, sizeof(audio_io_handle_t));
            (void)parcel->readInt32(&trackId);
            return NO_ERROR;
        }

@@ -163,6 +164,7 @@ public:
            (void)parcel->writeInt64(afSampleRate);
            (void)parcel->writeInt32(afLatencyMs);
            (void)parcel->write(&outputId, sizeof(audio_io_handle_t));
            (void)parcel->writeInt32(trackId);
            return NO_ERROR;
        }

@@ -179,6 +181,7 @@ public:
        uint32_t afSampleRate;
        uint32_t afLatencyMs;
        audio_io_handle_t outputId;
        int32_t trackId;
    };

    /* CreateRecordInput contains all input arguments sent by AudioRecord to AudioFlinger
+1 −0
Original line number Diff line number Diff line
@@ -788,6 +788,7 @@ sp<IAudioTrack> AudioFlinger::createTrack(const CreateTrackInput& input,
        output.afFrameCount = thread->frameCount();
        output.afSampleRate = thread->sampleRate();
        output.afLatencyMs = thread->latency();
        output.trackId = track->id();

        // move effect chain to this output thread if an effect on same session was waiting
        // for a track to be created