@@ -19,6 +19,7 @@ public class ImageReaderPlatformViewRenderTarget implements PlatformViewRenderTa
19
19
private int bufferWidth = 0 ;
20
20
private int bufferHeight = 0 ;
21
21
private static final String TAG = "ImageReaderPlatformViewRenderTarget" ;
22
+ private static final int MAX_IMAGES = 3 ;
22
23
23
24
private void closeReader () {
24
25
if (this .reader != null ) {
@@ -39,7 +40,7 @@ public void onImageAvailable(ImageReader reader) {
39
40
try {
40
41
image = reader .acquireLatestImage ();
41
42
} 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 ());
43
44
}
44
45
if (image == null ) {
45
46
return ;
@@ -52,7 +53,7 @@ public void onImageAvailable(ImageReader reader) {
52
53
protected ImageReader createImageReader33 () {
53
54
final ImageReader .Builder builder = new ImageReader .Builder (bufferWidth , bufferHeight );
54
55
// Allow for double buffering.
55
- builder .setMaxImages (3 );
56
+ builder .setMaxImages (MAX_IMAGES );
56
57
// Use PRIVATE image format so that we can support video decoding.
57
58
// TODO(johnmccutchan): Should we always use PRIVATE here? It may impact our
58
59
// ability to read back texture data. If we don't always want to use it, how do
@@ -78,7 +79,7 @@ protected ImageReader createImageReader29() {
78
79
bufferWidth ,
79
80
bufferHeight ,
80
81
ImageFormat .PRIVATE ,
81
- 3 ,
82
+ MAX_IMAGES ,
82
83
HardwareBuffer .USAGE_GPU_SAMPLED_IMAGE );
83
84
reader .setOnImageAvailableListener (this .onImageAvailableListener , onImageAvailableHandler );
84
85
return reader ;
0 commit comments