|
@ -79,10 +79,7 @@ public class UVCCameraTextureView extends AspectRatioTextureView // API >= 14 |
|
|
@Override |
|
|
@Override |
|
|
public void onResume() { |
|
|
public void onResume() { |
|
|
if (DEBUG) Log.v(TAG, "onResume:"); |
|
|
if (DEBUG) Log.v(TAG, "onResume:"); |
|
|
// if (mHasSurface) {
|
|
|
if (mHasSurface) { |
|
|
// mRenderHandler = RenderHandler.createHandler(mFpsCounter, super.getSurfaceTexture(), getWidth(), getHeight());
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (mRenderHandler == null) { |
|
|
|
|
|
mRenderHandler = RenderHandler.createHandler(mFpsCounter, super.getSurfaceTexture(), getWidth(), getHeight()); |
|
|
mRenderHandler = RenderHandler.createHandler(mFpsCounter, super.getSurfaceTexture(), getWidth(), getHeight()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -90,10 +87,10 @@ public class UVCCameraTextureView extends AspectRatioTextureView // API >= 14 |
|
|
@Override |
|
|
@Override |
|
|
public void onPause() { |
|
|
public void onPause() { |
|
|
if (DEBUG) Log.v(TAG, "onPause:"); |
|
|
if (DEBUG) Log.v(TAG, "onPause:"); |
|
|
// if (mRenderHandler != null) {
|
|
|
if (mRenderHandler != null) { |
|
|
// mRenderHandler.release();
|
|
|
mRenderHandler.release(); |
|
|
// mRenderHandler = null;
|
|
|
mRenderHandler = null; |
|
|
// }
|
|
|
} |
|
|
if (mTempBitmap != null) { |
|
|
if (mTempBitmap != null) { |
|
|
mTempBitmap.recycle(); |
|
|
mTempBitmap.recycle(); |
|
|
mTempBitmap = null; |
|
|
mTempBitmap = null; |
|
@ -102,7 +99,7 @@ public class UVCCameraTextureView extends AspectRatioTextureView // API >= 14 |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onSurfaceTextureAvailable(final SurfaceTexture surface, final int width, final int height) { |
|
|
public void onSurfaceTextureAvailable(final SurfaceTexture surface, final int width, final int height) { |
|
|
if (DEBUG) Log.v(TAG, "onSurfaceTextureAvailable:" + surface); |
|
|
if (DEBUG) Log.i(TAG, "onSurfaceTextureAvailable:" + surface); |
|
|
if (mRenderHandler == null) { |
|
|
if (mRenderHandler == null) { |
|
|
mRenderHandler = RenderHandler.createHandler(mFpsCounter, surface, width, height); |
|
|
mRenderHandler = RenderHandler.createHandler(mFpsCounter, surface, width, height); |
|
|
} else { |
|
|
} else { |
|
@ -116,7 +113,7 @@ public class UVCCameraTextureView extends AspectRatioTextureView // API >= 14 |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onSurfaceTextureSizeChanged(final SurfaceTexture surface, final int width, final int height) { |
|
|
public void onSurfaceTextureSizeChanged(final SurfaceTexture surface, final int width, final int height) { |
|
|
if (DEBUG) Log.v(TAG, "onSurfaceTextureSizeChanged:" + surface); |
|
|
if (DEBUG) Log.i(TAG, "onSurfaceTextureSizeChanged:" + surface); |
|
|
if (mRenderHandler != null) { |
|
|
if (mRenderHandler != null) { |
|
|
mRenderHandler.resize(width, height); |
|
|
mRenderHandler.resize(width, height); |
|
|
} |
|
|
} |
|
@ -127,7 +124,7 @@ public class UVCCameraTextureView extends AspectRatioTextureView // API >= 14 |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean onSurfaceTextureDestroyed(final SurfaceTexture surface) { |
|
|
public boolean onSurfaceTextureDestroyed(final SurfaceTexture surface) { |
|
|
if (DEBUG) Log.v(TAG, "onSurfaceTextureDestroyed:" + surface); |
|
|
if (DEBUG) Log.i(TAG, "onSurfaceTextureDestroyed:" + surface); |
|
|
if (mRenderHandler != null) { |
|
|
if (mRenderHandler != null) { |
|
|
mRenderHandler.release(); |
|
|
mRenderHandler.release(); |
|
|
mRenderHandler = null; |
|
|
mRenderHandler = null; |
|
|