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

Commit 1f98a065 authored by Ján Sebechlebský's avatar Ján Sebechlebský Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when there's unexpected non-YUV buffer input." into main

parents 79a02050 ac166cfe
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -386,6 +386,13 @@ ndk::ScopedAStatus VirtualCameraRenderThread::renderIntoBlobStreamBuffer(
  bool compressionSuccess = true;
  if (gBuffer != nullptr) {
    android_ycbcr ycbcr;
    if (gBuffer->getPixelFormat() != HAL_PIXEL_FORMAT_YCbCr_420_888) {
      ALOGE("%s: Cannot compress non-YUV buffer (pixelFormat %d)", __func__,
            gBuffer->getPixelFormat());
      AHardwareBuffer_unlock(hwBuffer.get(), nullptr);
      return cameraStatus(Status::INTERNAL_ERROR);
    }

    status_t status =
        gBuffer->lockYCbCr(AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, &ycbcr);
    ALOGV("Locked buffers");