Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
linsiang opened this issue Jul 29, 2022 · 9 comments

Comments

@linsiang
Copy link

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

@shiyinghan
Copy link
Owner

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

@shiyinghan
Copy link
Owner

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

@linsiang
Copy link
Author

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

@linsiang
Copy link
Author

linsiang commented Aug 1, 2022

你好,我选中你发我的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
Copy link
Owner

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

@linsiang
Copy link
Author

linsiang commented Aug 1, 2022

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

@shiyinghan
Copy link
Owner

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) {

  •        mAudioEncoder.release();
    

+// mAudioEncoder.release();
mAudioEncoder = null;
}

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

  •        mVideoEncoder.release();
    

+// mVideoEncoder.release();
mVideoEncoder = null;
}

@shiyinghan
Copy link
Owner

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

@linsiang
Copy link
Author

linsiang commented Aug 1, 2022

好的,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants