shiyinghan / UVCAndroid

Apache License 2.0
188 stars 51 forks source link

频繁的打开和关闭摄像头会导致闪退,开发板未为rk3288 #7

Open linsiang opened 2 years ago

linsiang commented 2 years ago

log.txt 如日志所示,如果在同一个activity里面操作了多次开关摄像头,或者是在不同的activity之间跳转,有一定的几率会发生崩溃,使用demo的开关也是这样

shiyinghan commented 2 years ago

你的这个日志没有什么有用的信息,崩溃错误出错的地方也是系统库,你可以把板子连电脑,然后用android studio把源码运行安装一下,应该能输出一些有用的日志,再发过来吧

shiyinghan commented 2 years ago

demo-debug.zip 或者解压一下这个压缩包,安装这个debug版本的安装包,再捕捉一下闪退日志

linsiang commented 2 years ago

好的,刚才用华为的手机测试了好久并没有出现这个问题,应该是只是这个板子会出现

linsiang commented 2 years ago

你好,我选中你发我的demo在androidstudio中进行调试,但是基本只能看到系统的错误,这个是大概能有点关联的,每次崩溃开始都是这句: 2022-08-01 11:42:19.931 3505-3604/com.herohan.uvcdemo A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3604 (CameraHelper), pid 3505 (herohan.uvcdemo) log_debug_nofilter.txt

shiyinghan commented 2 years ago

demo-debug.zip 你再试试这个demo的安装包,看log可能是系统固件的MediaCodec做的有问题,释放MediaCodec可能引起崩溃

linsiang commented 2 years ago

好的,这个demo好像不会了,开关了几十次,没有出现异常

shiyinghan commented 2 years ago

libuvccamera/src/main/java/com/herohan/uvcapp/VideoCapture.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libuvccamera/src/main/java/com/herohan/uvcapp/VideoCapture.java b/libuvccamera/src/main/java/com/herohan/uvcapp/VideoCapture.java index 533d0cd..ea34ddd 100644 --- a/libuvccamera/src/main/java/com/herohan/uvcapp/VideoCapture.java +++ b/libuvccamera/src/main/java/com/herohan/uvcapp/VideoCapture.java @@ -481,7 +481,7 @@ public class VideoCapture { private void releaseAudioInputResource() { mAudioHandlerThread.quitSafely(); if (mAudioEncoder != null) {

@@ -494,7 +494,7 @@ public class VideoCapture { @UiThread private void releaseCameraSurface(final boolean releaseVideoEncoder) { if (releaseVideoEncoder && mVideoEncoder != null) {

shiyinghan commented 2 years ago

嗯,这么来看,就是系统固件的问题,你如果想着这个固件上面使用本库的话,可以把VideoCapture文件里面的释放MediaCodec的操作注释掉

linsiang commented 2 years ago

好的,谢谢