gpt4 book ai didi

android - libvorbis-libogg-android中的本地引用表溢出(max = 512)

转载 作者:行者123 更新时间:2023-11-30 21:29:06 25 4
gpt4 key购买 nike

请帮助我,我正在用我的项目中的libvorbis-libogg-android录制声音并编码为ogg。当我的录制时间超过30秒时,我的应用崩溃了,

private class AsyncEncoding implements Runnable {
@Override
public void run() {
//Start the native encoder
Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
int result = 0;
switch (recordingType) {
case WITH_BITRATE:
result = VorbisEncoder.startEncodingWithBitrate(sampleRate, numberOfChannels, bitrate, encodeFeed);
break;
case WITH_QUALITY:
result = VorbisEncoder.startEncodingWithQuality(sampleRate, numberOfChannels, quality, encodeFeed);
break;
}
switch (result) {
case EncodeFeed.SUCCESS:
Log.d(TAG, "Encoder successfully finished");
recordHandler.sendEmptyMessage(FINISHED_SUCCESSFULLY);
break;
case EncodeFeed.ERROR_INITIALIZING:
recordHandler.sendEmptyMessage(ERROR_INITIALIZING);
Log.e(TAG, "There was an error initializing the native encoder");
break;
default:
recordHandler.sendEmptyMessage(FAILED_FOR_UNKNOWN_REASON);
Log.e(TAG, "Encoder returned an unknown result code");
break;
}
}


}

和我的错误

12-24 10:15:05.508 13519-15770/com.example.idek_2.testogg A/art: art/runtime/indirect_reference_table.cc:98] JNI ERROR (app bug): local reference table overflow (max=512)
12-24 10:15:05.508 13519-15770/com.example.idek_2.testogg A/art: art/runtime/indirect_reference_table.cc:98] local reference table dump:
12-24 10:15:05.508 13519-15770/com.example.idek_2.testogg A/art: art/runtime/indirect_reference_table.cc:98] Last 10 entries (of 512):
....
12-24 10:15:05.784 13519-15770/com.example.idek_2.testogg A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 15770 (Thread-31146)


我认为这里是我的问题,因为在此处创建表 https://github.com/vincentjames501/libvorbis-libogg-android/blob/master/jni/libvorbis-jni/org_xiph_vorbis_encoder_VorbisEncoder.c

最佳答案

我认为本地参考表是指JNI VM本身。在JNI内部,它维护对象的引用表,我怀疑您只是在不释放它们的情况下使用了太多的引用表。如果是别人写的代码,那应该向他们报告,这可能是一个错误。

如果您自己进行调查,请尝试阅读JNI文档,尤其要注意与全局和本地引用有关的调用,尤其是DeleteLocalRef函数。

关于android - libvorbis-libogg-android中的本地引用表溢出(max = 512),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34448876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com