Commit 4e32317a authored by Bill Orr's avatar Bill Orr Committed by Commit Bot

Fix bug where overflow caused us to stop submitting OpenVR frames

Approximately every 6 minutes VRDisplay would stop submitting frames
to OpenVRRenderLoop.  The reason for this is that VRDisplay won't
submit frames with a negative frame id.

Frame id is stored as a 16-bit signed int, overflowing after 32767.
32767 frames / (90fps*60sec/min) = 6.068 min before overflow

BUG=820525

Change-Id: Ie6131f3e246f7d38fa8790e1dd27cea7ff4cbb20
Reviewed-on: https://chromium-review.googlesource.com/957523Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Bill Orr <billorr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542270}
parent 6e1cf7c2
......@@ -224,8 +224,12 @@ base::WeakPtr<OculusRenderLoop> OculusRenderLoop::GetWeakPtr() {
void OculusRenderLoop::GetVSync(
mojom::VRPresentationProvider::GetVSyncCallback callback) {
int16_t frame = next_frame_id_++;
DCHECK(is_presenting_);
int16_t frame = next_frame_id_;
next_frame_id_ += 1;
if (next_frame_id_ < 0) {
next_frame_id_ = 0;
}
auto predicted_time =
ovr_GetPredictedDisplayTime(session_, ovr_frame_index_ + 1);
......
......@@ -169,8 +169,12 @@ base::WeakPtr<OpenVRRenderLoop> OpenVRRenderLoop::GetWeakPtr() {
void OpenVRRenderLoop::GetVSync(
mojom::VRPresentationProvider::GetVSyncCallback callback) {
int16_t frame = next_frame_id_++;
DCHECK(is_presenting_);
int16_t frame = next_frame_id_;
next_frame_id_ += 1;
if (next_frame_id_ < 0) {
next_frame_id_ = 0;
}
mojom::VRPosePtr pose = GetPose();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment