2

Very strange issue founded on Nexus 5x.

I have ordinary set of surfaces for camera app: - SurfaceHolder for on-screen preview - ImageReader in YUV format for preview frames data - ImageReader in YUV or JPEG format (depends on internal application mode selected) for capturing still images .

When JPEG ImageReader is used to configure captureSession, all works fine, on screen preview is normally exposed. But when YUV ImageReader is used, on-screen preview may be overexposed depended on composition. I have to make note, that exposure metering area is set to entire activeRect of sensor.

Check it out on this screenshots:

  1. Normal exposed preview. JPEG ImageReader is used. NORMAL EXPOSED PREVIEW. JPEG ImageReader is used

  2. Overexposed preview. YUV ImageReader is used. enter image description here

3&4. JPEG and YUV ImageReaders. Little bit other composition, and preview now is normally exposed for both cases. enter image description hereenter image description here

dur
  • 15,689
  • 25
  • 79
  • 125
Grinchman
  • 243
  • 4
  • 14

1 Answers1

2

Finally I found reason of that bug!

You'll be surprised, but that bug is forced by list of surfaces for capture session. More specifically, the addition order of surfaces into the list! If camera preview surface (SurfaceHolder) is adding first, then all works fine:

    // prepare list of surfaces to be used in capture requests
    List<Surface> sfl = new ArrayList<Surface>();

    sfl.add(mCameraSurface); // surface for viewfinder preview

    sfl.add(mPreviewImageReader.getSurface()); //preview data
    sfl.add(mImageReader.getSurface()); // surface for image capture

    // configure camera with all the surfaces to be ever used
    camDevice.createCaptureSession(sfl, new sessionListener(), null);

But when it's adding last we get that bug - overexposed preview!

// prepare list of surfaces to be used in capture requests
    List<Surface> sfl = new ArrayList<Surface>();

    sfl.add(mPreviewImageReader.getSurface()); //preview data
    sfl.add(mImageReader.getSurface()); // surface for image capture

    sfl.add(mCameraSurface); // surface for viewfinder preview

    // configure camera with all the surfaces to be ever used
    camDevice.createCaptureSession(sfl, new sessionListener(), null);

It blew my mind!

Grinchman
  • 243
  • 4
  • 14