Skip to content

Commit d221519

Browse files
Update ImageReaderSurfaceProducer.MAX_IMAGES to include the maximum number of retained dequeued images (flutter#174971)
MAX_IMAGES was set to 5 by flutter/engine@7a58dac in order to fix "client tried to acquire more than maxImages buffers" warnings from ImageReader_JNI. flutter@696251d then converted lastDequeuedImage into a queue that retains up to MAX_DEQUEUED_IMAGES in-flight images plus the latest dequeued image. MAX_DEQUEUED_IMAGES was set to 2, but MAX_IMAGES was only incremented by 1. So the ImageReader_JNI warning may reappear in some cases. This PR ensures that MAX_IMAGES provides enough capacity in the ImageReader for the total number of images that may be in use.
1 parent 7f111dd commit d221519

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ final class ImageReaderSurfaceProducer
413413
TextureRegistry.ImageConsumer,
414414
TextureRegistry.OnTrimMemoryListener {
415415
private static final String TAG = "ImageReaderSurfaceProducer";
416-
private static final int MAX_IMAGES = 6;
417416
// The ImageReaderSurfaceProducer must not close images until the renderer,
418417
// either Skia OpenGL, Impeller OpenGL, or Impeller Vulkan is done reading
419418
// from them. The Vulkan renderer allows up to two frames in flight before
@@ -422,6 +421,7 @@ final class ImageReaderSurfaceProducer
422421
// the frame that references them has finished rendering can result in
423422
// tearing or other incorrect rendering.
424423
private static final int MAX_DEQUEUED_IMAGES = 2;
424+
private static final int MAX_IMAGES = 5 + MAX_DEQUEUED_IMAGES;
425425

426426
// Flip when debugging to see verbose logs.
427427
private static final boolean VERBOSE_LOGS = false;

0 commit comments

Comments
 (0)