HDMI-in as camera image is mirrored sometimes

Which system do you use? Android, Ubuntu, OOWOW or others?

Android

Which version of system do you use? Khadas official images, self built images, or others?

Latest Khadas image

Please describe your issue below:

Randomly (!), the HDMI-in camera preview image is mirrored. We use CameraX and PreviewView, nothing special.

This only affects the preview. Doing an imagecapture gives us the image in the correct orientation.

Destroying and recreating the camera preview rolls another dice, sometimes it’s fixed, sometimes not.

@cadahl Please try modifying as follows.

hardware/amlogic/camera$ git diff
diff --git a/camera/v3/EmulatedFakeCamera3.cpp b/camera/v3/EmulatedFakeCamera3.cpp
index b8af8628..c173b318 100644
--- a/camera/v3/EmulatedFakeCamera3.cpp
+++ b/camera/v3/EmulatedFakeCamera3.cpp
@@ -1892,8 +1892,8 @@ status_t EmulatedFakeCamera3::constructStaticInfo() {
         }
         break;
      case SENSOR_HDMI:
-        lensFacing =  ANDROID_LENS_FACING_FRONT;
-        mFacingBack = 0;
+        lensFacing =  ANDROID_LENS_FACING_BACK;
+        mFacingBack = 1;
         break;
      default:
          ALOGE("not support this sensor type!");
diff --git a/camera/v3/fake-pipeline2/HDMISensor.cpp b/camera/v3/fake-pipeline2/HDMISensor.cpp
index 6d5d8308..59fb6b55 100644
--- a/camera/v3/fake-pipeline2/HDMISensor.cpp
+++ b/camera/v3/fake-pipeline2/HDMISensor.cpp
@@ -601,7 +601,7 @@ void HDMISensor::captureNV21(StreamBuffer b, uint32_t gain) {
                 mGE2D->ge2d_scale(b.share_fd, PIXEL_FORMAT_YCbCr_420_SP_NV12, b.width, b.height, output_info.dma_fd, width, height);
             }
         }
-        mGE2D->doRotationAndMirror(b, true);
+        //mGE2D->doRotationAndMirror(b, true);
         mSensorWorkFlag = true;