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

Commit c6bed216 authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am a3b97ad2: Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-dev

* commit 'a3b97ad2':
  audioflinger: implement getTimestamp() for offloaded tracks
parents ce3e7cb0 a3b97ad2
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2339,6 +2339,22 @@ void AudioFlinger::PlaybackThread::removeTracks_l(const Vector< sp<Track> >& tra

}

status_t AudioFlinger::PlaybackThread::getTimestamp_l(AudioTimestamp& timestamp)
{
    if (mNormalSink != 0) {
        return mNormalSink->getTimestamp(timestamp);
    }
    if (mType == OFFLOAD && mOutput->stream->get_presentation_position) {
        uint64_t position64;
        int ret = mOutput->stream->get_presentation_position(
                                                mOutput->stream, &position64, &timestamp.mTime);
        if (ret == 0) {
            timestamp.mPosition = (uint32_t)position64;
            return NO_ERROR;
        }
    }
    return INVALID_OPERATION;
}
// ----------------------------------------------------------------------------

AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
+2 −0
Original line number Diff line number Diff line
@@ -466,6 +466,8 @@ public:
                // Return's the HAL's frame count i.e. fast mixer buffer size.
                size_t      frameCountHAL() const { return mFrameCount; }

                status_t         getTimestamp_l(AudioTimestamp& timestamp);

protected:
    // updated by readOutputParameters()
    size_t                          mNormalFrameCount;  // normal mixer and effects
+16 −12
Original line number Diff line number Diff line
@@ -757,6 +757,7 @@ status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& times
    }
    Mutex::Autolock _l(thread->mLock);
    PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
    if (!isOffloaded()) {
        if (!playbackThread->mLatchQValid) {
            return INVALID_OPERATION;
        }
@@ -772,6 +773,9 @@ status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& times
        return NO_ERROR;
    }

    return playbackThread->getTimestamp_l(timestamp);
}

status_t AudioFlinger::PlaybackThread::Track::attachAuxEffect(int EffectId)
{
    status_t status = DEAD_OBJECT;