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

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

aaudio: disable new external timestamp

Disable recent change that caused a regression and broke
OUTPUT timestamps.

Bug: 169773867
Test: OboeTester, TEST OUTPUT
Test: "latnc" for MMAP streams should be a few msec not "?"
Change-Id: I7c4697a34d63a1fd514298f04fc91421c2bb32b1
parent 8d97b8e3
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <utils/Log.h>
#include <utils/Log.h>


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


// Get timestamp from presentation position.
// 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,
aaudio_result_t AAudioServiceStreamMMAP::getHardwareTimestamp(int64_t *positionFrames,
                                                                int64_t *timeNanos) {
                                                                int64_t *timeNanos) {


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


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