Do not write into EglSurfaceTexture after creation
... beacuse it prevents other clients from connecting.
Instead, render/compress black image into output buffers
directly if the input surface texture doesn't have any
buffer yet.
Bug: 301023410
Test: OpenCamera
Test: atest virtual_camera_tests
Change-Id: I289ff00b590c9bc18052ae0cc15a9d7320b8f033
diff --git a/services/camera/virtualcamera/util/JpegUtil.h b/services/camera/virtualcamera/util/JpegUtil.h
index 8bff008..c44d0a8 100644
--- a/services/camera/virtualcamera/util/JpegUtil.h
+++ b/services/camera/virtualcamera/util/JpegUtil.h
@@ -27,9 +27,15 @@
namespace virtualcamera {
// Jpeg-compress image into the output buffer.
+// Returns true if the compression was successful, false otherwise.
bool compressJpeg(int width, int height, const android_ycbcr& ycbcr,
size_t outBufferSize, void* outBuffer);
+// Jpeg-compress all-black image into the output buffer.
+// Returns true if the compression was successful, false otherwise.
+bool compressBlackJpeg(int width, int height, size_t outBufferSize,
+ void* outBuffer);
+
} // namespace virtualcamera
} // namespace companion
} // namespace android