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

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

Merge "aaudio: disable new external timestamp"

parents 4dc1aa89 f95ed73e
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <utils/Log.h>

#include <atomic>
#include <inttypes.h>
#include <iomanip>
#include <iostream>
#include <stdint.h>
@@ -163,7 +164,7 @@ aaudio_result_t AAudioServiceStreamMMAP::getFreeRunningPosition(int64_t *positio
}

// Get timestamp from presentation position.
// If fails, get time stamp that was written by getFreeRunningPosition()
// If it fails, get timestamp that was written by getFreeRunningPosition()
aaudio_result_t AAudioServiceStreamMMAP::getHardwareTimestamp(int64_t *positionFrames,
                                                                int64_t *timeNanos) {

@@ -175,11 +176,18 @@ aaudio_result_t AAudioServiceStreamMMAP::getHardwareTimestamp(int64_t *positionF
    sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP =
            static_cast<AAudioServiceEndpointMMAP *>(endpoint.get());

    // Disable this code temporarily because the HAL is not returning
    // a useful result.
#if 0
    uint64_t position;
    if (serviceEndpointMMAP->getExternalPosition(&position, timeNanos) == AAUDIO_OK) {
        ALOGD("%s() getExternalPosition() says pos = %" PRIi64 ", time = %" PRIi64,
                __func__, position, *timeNanos);
        *positionFrames = (int64_t) position;
        return AAUDIO_OK;
    } else if (mAtomicStreamTimestamp.isValid()) {
    } else
#endif
    if (mAtomicStreamTimestamp.isValid()) {
        Timestamp timestamp = mAtomicStreamTimestamp.read();
        *positionFrames = timestamp.getPosition();
        *timeNanos = timestamp.getNanoseconds() + serviceEndpointMMAP->getHardwareTimeOffsetNanos();