public long getCurrentPresentationTimeUs() {
        // Return the PTS_NOT_SET flag when the PTS has not been initialized yet. At the start of
        // media playback, returning the playback head alone is reliable, but later on (e.g. after a
        // seek), a missing PTS offset leads to totally wrong values.
        if(mPresentationTimeOffsetUs == PTS_NOT_SET) {
            return PTS_NOT_SET;
        }

        long playbackHeadPositionUs = getPlaybackheadPositionUs();

        // Handle playback head wrapping
        if(playbackHeadPositionUs < mLastPlaybackHeadPositionUs) {
            // playback head position has wrapped around it's 32bit uint value
            Log.d(TAG, "playback head has wrapped");
            // Add the full runtime to the PTS offset to advance it one playback head iteration
            mPresentationTimeOffsetUs += (long)((double)0xFFFFFFFF / mSampleRate * 1000000);
        }
        mLastPlaybackHeadPositionUs = playbackHeadPositionUs;

        // Return the playback head time, offset by the start offset PTS
        return mPresentationTimeOffsetUs + playbackHeadPositionUs;
    }
Returns the current PTS of the playback head or PTS_NOT_SET if the PTS cannot be reliably
calculated yet.
For this method to return a PTS, audio samples need to be written before ({@link #write(ByteBuffer, long)}.
@return the PTS at the playback head or PTS_NOT_SET if unknown
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/AudioPlayback.java