Browse Source

修复getSurfaceTexture返回Null异常

main 1.3.7
jiangdongguo 7 years ago
parent
commit
f59f64be15
  1. 16
      libusbcamera/libusbcamera.iml
  2. 2
      libusbcamera/src/main/java/com/jiangdg/usbcamera/USBCameraManager.java
  3. 13
      libusbcamera/src/main/java/com/serenegiant/usb/widget/UVCCameraTextureView.java

16
libusbcamera/libusbcamera.iml

@ -67,14 +67,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@ -83,6 +75,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />

2
libusbcamera/src/main/java/com/jiangdg/usbcamera/USBCameraManager.java

@ -198,7 +198,7 @@ public class USBCameraManager{
} }
}); });
} }
/** /**
* 注册检测USB设备广播接收器 * 注册检测USB设备广播接收器
* */ * */

13
libusbcamera/src/main/java/com/serenegiant/usb/widget/UVCCameraTextureView.java

@ -79,7 +79,10 @@ 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());
} }
} }
@ -87,10 +90,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;

Loading…
Cancel
Save