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

空指针异常 #856

Open
tianguo1314 opened this issue Dec 28, 2022 · 3 comments
Open

空指针异常 #856

tianguo1314 opened this issue Dec 28, 2022 · 3 comments

Comments

@tianguo1314
Copy link

2022-12-28 15:09:19.155 32386-6668/com.north.arrow.technology E/CrashReport: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.AudioRecord.read(byte[], int, int)' on a null object reference
at net.ossrs.yasea.SrsPublisher$2.run(SrsPublisher.java:107)
at java.lang.Thread.run(Thread.java:929)
2022-12-28 15:09:19.155 32386-6668/com.north.arrow.technology E/CrashReport: #++++++++++++++++++++++++++++++++++++++++++#

if(mic!=null){
int size = mic.read(mPcmBuffer, 0, mPcmBuffer.length);
if (size > 0) {
mEncoder.onGetPcmFrame(mPcmBuffer, size);
}
}

我对mic进行了非空判断还是出现了空指针

@begeekmyfriend
Copy link
Owner

begeekmyfriend commented Dec 29, 2022

抱歉已经不从事安卓开发了,偶尔上来看一看。你的安卓SDK还有底层驱动是官方的还是定制的?如果是定制的建议先排查一下底层问题,毕竟还没有跟您类似的问题反馈。

@tianguo1314
Copy link
Author

不是定制化的 就是平常的手机

@begeekmyfriend
Copy link
Owner

安卓版本变化很多,也许我当时的SDK版本落后了,你可以调试一下chooseAudioRecord函数,看看是不是适合你,如果有改动,欢迎PR

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