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

Commit 55817ab9 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android Git Automerger
Browse files

am fe346c70: Fix miscellanous AudioTrack::getTimestamp() bugs

* commit 'fe346c70':
  Fix miscellanous AudioTrack::getTimestamp() bugs
parents 6c993a96 fe346c70
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,18 @@ status_t AudioTrack::setParameters(const String8& keyValuePairs)
status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp)
{
    AutoMutex lock(mLock);
    return mAudioTrack->getTimestamp(timestamp);
    // FIXME not implemented for fast tracks; should use proxy and SSQ
    if (mFlags & AUDIO_OUTPUT_FLAG_FAST) {
        return INVALID_OPERATION;
    }
    if (mState != STATE_ACTIVE && mState != STATE_PAUSED) {
        return INVALID_OPERATION;
    }
    status_t status = mAudioTrack->getTimestamp(timestamp);
    if (status == NO_ERROR) {
        timestamp.mPosition += mProxy->getEpoch();
    }
    return status;
}

String8 AudioTrack::getParameters(const String8& keys)
+3 −0
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ status_t AudioStreamOutSink::getNextWriteTimestamp(int64_t *timestamp) {

status_t AudioStreamOutSink::getTimestamp(AudioTimestamp& timestamp)
{
    if (mStream->get_presentation_position == NULL) {
        return INVALID_OPERATION;
    }
    // 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);
+5 −1
Original line number Diff line number Diff line
@@ -727,9 +727,13 @@ status_t AudioFlinger::PlaybackThread::Track::setParameters(const String8& keyVa

status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& timestamp)
{
    // Client should implement this using SSQ; the unpresented frame count in latch is irrelevant
    if (isFastTrack()) {
        return INVALID_OPERATION;
    }
    sp<ThreadBase> thread = mThread.promote();
    if (thread == 0) {
        return false;
        return INVALID_OPERATION;
    }
    Mutex::Autolock _l(thread->mLock);
    PlaybackThread *playbackThread = (PlaybackThread *)thread.get();