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

Commit 943ba3cc authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Add NBAIO_Sink::getTimestamp()" into klp-dev

parents 572864b9 767094dd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ public:
    // implementation of GNWT (if any)
    virtual status_t getNextWriteTimestamp(int64_t *timestamp);

    virtual status_t getTimestamp(AudioTimestamp& timestamp);

    // NBAIO_Sink end

#if 0   // until necessary
+3 −0
Original line number Diff line number Diff line
@@ -88,6 +88,9 @@ public:
            // Return true if the write side of a pipe is currently shutdown.
            bool    isShutdown();

            // Return NO_ERROR if there is a timestamp available
            status_t getTimestamp(AudioTimestamp& timestamp);

private:
    // A pair of methods and a helper variable which allows the reader and the
    // writer to update and observe the values of mFront and mNextRdPTS in an
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <media/AudioTimestamp.h>

namespace android {

@@ -213,6 +214,11 @@ public:
    //  <other> Something unexpected happened internally.  Check the logs and start debugging.
    virtual status_t getNextWriteTimestamp(int64_t *ts) { return INVALID_OPERATION; }

    // Returns NO_ERROR if a timestamp is available.  The timestamp includes the total number
    // of frames presented to an external observer, together with the value of CLOCK_MONOTONIC
    // as of this presentation count.
    virtual status_t getTimestamp(AudioTimestamp& timestamp) { return INVALID_OPERATION; }

protected:
    NBAIO_Sink(NBAIO_Format format = Format_Invalid) : NBAIO_Port(format), mFramesWritten(0) { }
    virtual ~NBAIO_Sink() { }
+12 −0
Original line number Diff line number Diff line
@@ -79,4 +79,16 @@ status_t AudioStreamOutSink::getNextWriteTimestamp(int64_t *timestamp) {
    return mStream->get_next_write_timestamp(mStream, timestamp);
}

status_t AudioStreamOutSink::getTimestamp(AudioTimestamp& timestamp)
{
    // FIXME position64 won't be needed after AudioTimestamp.mPosition is changed to uint64_t
    uint64_t position64;
    int ok = mStream->get_presentation_position(mStream, &position64, &timestamp.mTime);
    if (ok != 0) {
        return INVALID_OPERATION;
    }
    timestamp.mPosition = position64;
    return OK;
}

}   // namespace android
+5 −0
Original line number Diff line number Diff line
@@ -310,4 +310,9 @@ bool MonoPipe::isShutdown()
    return mIsShutdown;
}

status_t MonoPipe::getTimestamp(AudioTimestamp& timestamp)
{
    return INVALID_OPERATION;
}

}   // namespace android
Loading