@@ -19,6 +19,7 @@ public class ImageReaderPlatformViewRenderTarget implements PlatformViewRenderTa
1919  private  int  bufferWidth  = 0 ;
2020  private  int  bufferHeight  = 0 ;
2121  private  static  final  String  TAG  = "ImageReaderPlatformViewRenderTarget" ;
22+   private  static  final  int  MAX_IMAGES  = 3 ;
2223
2324  private  void  closeReader () {
2425    if  (this .reader  != null ) {
@@ -39,7 +40,7 @@ public void onImageAvailable(ImageReader reader) {
3940          try  {
4041            image  = reader .acquireLatestImage ();
4142          } catch  (IllegalStateException  e ) {
42-             Log .e (TAG , "New image available that  could not be acquired: "  + e .toString ());
43+             Log .e (TAG , "New image available but it  could not be acquired: "  + e .toString ());
4344          }
4445          if  (image  == null ) {
4546            return ;
@@ -52,7 +53,7 @@ public void onImageAvailable(ImageReader reader) {
5253  protected  ImageReader  createImageReader33 () {
5354    final  ImageReader .Builder  builder  = new  ImageReader .Builder (bufferWidth , bufferHeight );
5455    // Allow for double buffering. 
55-     builder .setMaxImages (3 );
56+     builder .setMaxImages (MAX_IMAGES );
5657    // Use PRIVATE image format so that we can support video decoding. 
5758    // TODO(johnmccutchan): Should we always use PRIVATE here? It may impact our 
5859    // ability to read back texture data. If we don't always want to use it, how do 
@@ -78,7 +79,7 @@ protected ImageReader createImageReader29() {
7879            bufferWidth ,
7980            bufferHeight ,
8081            ImageFormat .PRIVATE ,
81-             3 ,
82+             MAX_IMAGES ,
8283            HardwareBuffer .USAGE_GPU_SAMPLED_IMAGE );
8384    reader .setOnImageAvailableListener (this .onImageAvailableListener , onImageAvailableHandler );
8485    return  reader ;
0 commit comments