diff --git a/modules/java/generator/src/java/android+JavaCameraView.java b/modules/java/generator/src/java/android+JavaCameraView.java index 3bef2e0c382a..f864e5370b1e 100644 --- a/modules/java/generator/src/java/android+JavaCameraView.java +++ b/modules/java/generator/src/java/android+JavaCameraView.java @@ -38,7 +38,7 @@ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallb private boolean mStopThread; protected Camera mCamera; - protected JavaCameraFrame mCameraFrame; + protected JavaCameraFrame[] mCameraFrame; private SurfaceTexture mSurfaceTexture; public static class JavaCameraSizeAccessor implements ListItemAccessor { @@ -180,7 +180,9 @@ protected boolean initializeCamera(int width, int height) { AllocateCache(); - mCameraFrame = new JavaCameraFrame(mFrameChain[mChainIdx], mFrameWidth, mFrameHeight); + mCameraFrame = new JavaCameraFrame[2]; + mCameraFrame[0] = new JavaCameraFrame(mFrameChain[0], mFrameWidth, mFrameHeight); + mCameraFrame[1] = new JavaCameraFrame(mFrameChain[1], mFrameWidth, mFrameHeight); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID); @@ -216,8 +218,10 @@ protected void releaseCamera() { mFrameChain[0].release(); mFrameChain[1].release(); } - if (mCameraFrame != null) - mCameraFrame.release(); + if (mCameraFrame != null) { + mCameraFrame[0].release(); + mCameraFrame[1].release(); + } } } @@ -318,7 +322,7 @@ public void run() { if (!mStopThread) { if (!mFrameChain[mChainIdx].empty()) - deliverAndDrawFrame(mCameraFrame); + deliverAndDrawFrame(mCameraFrame[mChainIdx]); mChainIdx = 1 - mChainIdx; } } while (!mStopThread);