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

Commit c0959648 authored by Phil Burk's avatar Phil Burk
Browse files

aaudio: fix uninitialized var in getBestTimestamp

The localPosition was used even if it was not set by another
function. Now we only use it if OK.

Bug: 77659012
Test: input_monitor.cpp -m1 -pn
Change-Id: I10648c5c17d42bb31d83fb14c1bda3ec527a3924
parent fe463237
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -179,20 +179,18 @@ aaudio_result_t AudioStreamLegacy::getBestTimestamp(clockid_t clockId,
    int64_t localPosition;
    status_t status = extendedTimestamp->getBestTimestamp(&localPosition, timeNanoseconds,
                                                          timebase, &location);
    if (status == OK) {
        // use MonotonicCounter to prevent retrograde motion.
        mTimestampPosition.update32((int32_t) localPosition);
        *framePosition = mTimestampPosition.get();
    }

//    ALOGD("getBestTimestamp() fposition: server = %6lld, kernel = %6lld, location = %d",
//          (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_SERVER],
//          (long long) extendedTimestamp->mPosition[ExtendedTimestamp::Location::LOCATION_KERNEL],
//          (int)location);
    if (status == WOULD_BLOCK) {
        return AAUDIO_ERROR_INVALID_STATE;
    } else {
    return AAudioConvert_androidToAAudioResult(status);
}
}

void AudioStreamLegacy::onAudioDeviceUpdate(audio_port_handle_t deviceId)
{