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

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

Fix delay used when polling for rendered buffers am: fce530c3

parents e9d3b005 fce530c3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -6293,7 +6293,9 @@ status_t MediaCodec::onReleaseOutputBuffer(const sp<AMessage> &msg) {
            // 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
            // 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 */
            status_t err =
                    mMsgPollForRenderedBuffers->postUnique(/* token= */ mMsgPollForRenderedBuffers,