Fix display orientation handling
- Apply the orientation compensator before the filter. Otherwise, we
won't tend to identity, but rather to a rotated frame, which is
incorrect.
- Enable rate limiting when orientation changes, but only when a new
world-to-screen pose arrives. This makes sure that rate limiting is
applied at the point of discontinuity regardless of the order of
operations.
Test: atest --host libheadtracking-test
Bug: 188502620
Change-Id: I58e1c3807f875ae2735e65122a3ffb8483bde2a3
diff --git a/media/libheadtracking/HeadTrackingProcessor-test.cpp b/media/libheadtracking/HeadTrackingProcessor-test.cpp
index 1739c6d..299192f 100644
--- a/media/libheadtracking/HeadTrackingProcessor-test.cpp
+++ b/media/libheadtracking/HeadTrackingProcessor-test.cpp
@@ -53,10 +53,10 @@
processor->setWorldToHeadPose(0, Pose3f(), Twist3f());
processor->setWorldToScreenPose(0, Pose3f());
+ processor->setDisplayOrientation(physicalToLogical);
processor->setWorldToHeadPose(0, worldToHead, Twist3f());
processor->setWorldToScreenPose(0, worldToScreen);
processor->setScreenToStagePose(screenToStage);
- processor->setDisplayOrientation(physicalToLogical);
processor->calculate(0);
ASSERT_EQ(processor->getActualMode(), HeadTrackingMode::SCREEN_RELATIVE);
EXPECT_EQ(processor->getHeadToStagePose(), worldToHead.inverse() * worldToScreen *