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

Commit 23e9c391 authored by Brian Lindahl's avatar Brian Lindahl Committed by Gerrit Code Review
Browse files

Merge "Process skipped frames the correct order, per content time" into main

parents 235d69d2 bec1a5d5
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -302,13 +302,6 @@ void VideoRenderQualityTracker::onFrameRendered(int64_t contentTimeUs, int64_t a
        mRenderDurationMs += (actualRenderTimeUs - mLastRenderTimeUs) / 1000;
    }

    // Now that a frame has been rendered, the previously skipped frames can be processed as skipped
    // frames since the app is not skipping them to terminate playback.
    for (int64_t contentTimeUs : mPendingSkippedFrameContentTimeUsList) {
        processMetricsForSkippedFrame(contentTimeUs);
    }
    mPendingSkippedFrameContentTimeUsList = {};

    // We can render a pending queued frame if it's the last frame of the video, so release it
    // immediately.
    if (contentTimeUs == mTunnelFrameQueuedContentTimeUs && mTunnelFrameQueuedContentTimeUs != -1) {
@@ -332,9 +325,25 @@ void VideoRenderQualityTracker::onFrameRendered(int64_t contentTimeUs, int64_t a
                  (long long) contentTimeUs, (long long) nextExpectedFrame.contentTimeUs);
            break;
        }
        // Process all skipped frames before the dropped frame.
        while (!mPendingSkippedFrameContentTimeUsList.empty()) {
            if (mPendingSkippedFrameContentTimeUsList.front() >= nextExpectedFrame.contentTimeUs) {
                break;
            }
            processMetricsForSkippedFrame(mPendingSkippedFrameContentTimeUsList.front());
            mPendingSkippedFrameContentTimeUsList.pop_front();
        }
        processMetricsForDroppedFrame(nextExpectedFrame.contentTimeUs,
                                      nextExpectedFrame.desiredRenderTimeUs);
    }
    // Process all skipped frames before the rendered frame.
    while (!mPendingSkippedFrameContentTimeUsList.empty()) {
        if (mPendingSkippedFrameContentTimeUsList.front() >= nextExpectedFrame.contentTimeUs) {
            break;
        }
        processMetricsForSkippedFrame(mPendingSkippedFrameContentTimeUsList.front());
        mPendingSkippedFrameContentTimeUsList.pop_front();
    }
    processMetricsForRenderedFrame(nextExpectedFrame.contentTimeUs,
                                   nextExpectedFrame.desiredRenderTimeUs, actualRenderTimeUs,
                                   freezeEventOut, judderEventOut);