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

Commit df228c25 authored by Brian Lindahl's avatar Brian Lindahl Committed by Automerger Merge Worker
Browse files

Fix delay used when polling for rendered buffers am: d42a8ea9

parents 66fc6653 d42a8ea9
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -6185,7 +6185,9 @@ status_t MediaCodec::onReleaseOutputBuffer(const sp<AMessage> &msg) {
            // presentation timestamp is used instead, which almost certainly occurs in the past,
            // presentation timestamp is used instead, which almost certainly occurs in the past,
            // since it's almost always a zero-based offset from the start of the stream. In these
            // since it's almost always a zero-based offset from the start of the stream. In these
            // scenarios, we expect the frame to be rendered with no delay.
            // scenarios, we expect the frame to be rendered with no delay.
            int64_t delayUs = noRenderTime ? 0 : renderTimeNs / 1000 - ALooper::GetNowUs();
            int64_t nowUs = ALooper::GetNowUs();
            int64_t renderTimeUs = renderTimeNs / 1000;
            int64_t delayUs = renderTimeUs < nowUs ? 0 : renderTimeUs - nowUs;
            delayUs += 100 * 1000; /* 100ms in microseconds */
            delayUs += 100 * 1000; /* 100ms in microseconds */
            status_t err =
            status_t err =
                    mMsgPollForRenderedBuffers->postUnique(/* token= */ mMsgPollForRenderedBuffers,
                    mMsgPollForRenderedBuffers->postUnique(/* token= */ mMsgPollForRenderedBuffers,