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

Commit d4e5e6af authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "aaudio: reduce error logging"

parents 5bd4252a 7216b3fe
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -314,8 +314,11 @@ aaudio_result_t AudioStream::safeRelease() {

void AudioStream::setState(aaudio_stream_state_t state) {
    ALOGD("%s(s#%d) from %d to %d", __func__, getId(), mState, state);
    if (state == mState) {
        return; // no change
    }
    // Track transition to DISCONNECTED state.
    if (state == AAUDIO_STREAM_STATE_DISCONNECTED && mState != state) {
    if (state == AAUDIO_STREAM_STATE_DISCONNECTED) {
        android::mediametrics::LogItem(mMetricsId)
                .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_DISCONNECT)
                .set(AMEDIAMETRICS_PROP_STATE, AudioGlobal_convertStreamStateToText(getState()))
@@ -323,18 +326,18 @@ void AudioStream::setState(aaudio_stream_state_t state) {
    }
    // CLOSED is a final state
    if (mState == AAUDIO_STREAM_STATE_CLOSED) {
        ALOGE("%s(%d) tried to set to %d but already CLOSED", __func__, getId(), state);
        ALOGW("%s(%d) tried to set to %d but already CLOSED", __func__, getId(), state);

    // Once CLOSING, we can only move to CLOSED state.
    } else if (mState == AAUDIO_STREAM_STATE_CLOSING
               && state != AAUDIO_STREAM_STATE_CLOSED) {
        ALOGE("%s(%d) tried to set to %d but already CLOSING", __func__, getId(), state);
        ALOGW("%s(%d) tried to set to %d but already CLOSING", __func__, getId(), state);

    // Once DISCONNECTED, we can only move to CLOSING or CLOSED state.
    } else if (mState == AAUDIO_STREAM_STATE_DISCONNECTED
               && !(state == AAUDIO_STREAM_STATE_CLOSING
                   || state == AAUDIO_STREAM_STATE_CLOSED)) {
        ALOGE("%s(%d) tried to set to %d but already DISCONNECTED", __func__, getId(), state);
        ALOGW("%s(%d) tried to set to %d but already DISCONNECTED", __func__, getId(), state);

    } else {
        mState = state;
+0 −3
Original line number Diff line number Diff line
@@ -212,9 +212,6 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
    setSamplesPerFrame(mAudioRecord->channelCount());

    int32_t actualSampleRate = mAudioRecord->getSampleRate();
    ALOGW_IF(actualSampleRate != getSampleRate(),
             "open() sampleRate changed from %d to %d",
             getSampleRate(), actualSampleRate);
    setSampleRate(actualSampleRate);

    // We may need to pass the data through a block size adapter to guarantee constant size.
+3 −6
Original line number Diff line number Diff line
@@ -195,9 +195,6 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
    setDeviceFormat(mAudioTrack->format());

    int32_t actualSampleRate = mAudioTrack->getSampleRate();
    ALOGW_IF(actualSampleRate != getSampleRate(),
             "open() sampleRate changed from %d to %d",
             getSampleRate(), actualSampleRate);
    setSampleRate(actualSampleRate);

    // We may need to pass the data through a block size adapter to guarantee constant size.
@@ -240,11 +237,11 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)

    setSharingMode(AAUDIO_SHARING_MODE_SHARED); // EXCLUSIVE mode not supported in legacy

    // Log warning if we did not get what we asked for.
    ALOGW_IF(actualFlags != flags,
    // Log if we did not get what we asked for.
    ALOGD_IF(actualFlags != flags,
             "open() flags changed from 0x%08X to 0x%08X",
             flags, actualFlags);
    ALOGW_IF(actualPerformanceMode != perfMode,
    ALOGD_IF(actualPerformanceMode != perfMode,
             "open() perfMode changed from %d to %d",
             perfMode, actualPerformanceMode);