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

Commit 5f900c5d authored by Vadim Caen's avatar Vadim Caen
Browse files

Fix timestamp not increasing on repeated frame

When repeating the last drawn frame from the input surface, we were not
increasing the timestamp if the surface had a timestamp > 0.

Fixes: 372374102
Test: CtsVirtualDevicesCameraCtsTestCases
Flag: android.companion.virtualdevice.flags.camera_timestamp_from_surface
Change-Id: I6e8e08b60965a20a72361ead3e4d82ec173c66e5
parent d35f9921
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -557,8 +557,9 @@ std::chrono::nanoseconds VirtualCameraRenderThread::throttleRendering(
std::chrono::nanoseconds VirtualCameraRenderThread::getSurfaceTimestamp(
    std::chrono::nanoseconds timeSinceLastFrame) {
  std::chrono::nanoseconds surfaceTimestamp = mEglSurfaceTexture->getTimestamp();
  if (surfaceTimestamp.count() < 0) {
  uint64_t lastSurfaceTimestamp = mLastSurfaceTimestampNanoseconds.load();
  if (surfaceTimestamp.count() < 0 ||
      surfaceTimestamp.count() == lastSurfaceTimestamp) {
    if (lastSurfaceTimestamp > 0) {
      // The timestamps were provided by the producer but we are
      // repeating the last frame, so we increase the previous timestamp by