我正在开发在单击按钮全部播放后播放音频文件列表的应用程序,在播放每个文件后,我从https://github.com/felixpalmer/android-visualizer重新创建了一个新的 VisualizerView 问题:有时我觉得这很讨厌致命错误 11 我有时在第二个项目之后无法弄清楚模式,有时它玩得很好 40 个项目没有问题。
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),
afd.getLength());
afd.close();
showVisualizer(mMediaPlayer);
mMediaPlayer.prepare();
mMediaPlayer.start();
public void showVisualizer(MediaPlayer mp) {
if (!mShowVisualizer) {
return;
}
//add new
mVisualizerView = new VisualizerView(this);
mVisualizerView.link(mp);
mFrameVisualizer.addView(mVisualizerView);
mFrameVisualizer.setVisibility(View.VISIBLE);
if (visualizerType.equals(getString(R.string.visualizer_line))) {
addLineRenderer(mVisualizerView);
} else if (visualizerType.equals(getString(R.string.visualizer_bar))) {
addBarGraphRenderers(mVisualizerView);
} else {
Log.e(TAG, "Unrecognized renderer");
}
}
public void hideVisualizer() {
if (mFrameVisualizer.getVisibility() != View.GONE) {
mFrameVisualizer.setVisibility(View.GONE);
Log.d(TAG, mVisualizerView + " mVis vuew");
if (mVisualizerView != null) {
mFrameVisualizer.removeView(mVisualizerView);
mVisualizerView.release();
Log.d(TAG, mVisualizerView + " mVisualizerView released");
mVisualizerView = null;
}
}
}
更新:堆栈跟踪:
01-13 21:21:56.416 30943 847 F libc : Fatal signal 11 (SIGSEGV) at 0x44a00000 (code=2), thread 847 (Visualizer)
01-13 21:21:56.471 2577 2577 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-13 21:21:56.471 2577 2577 I DEBUG : Build fingerprint: 'samsung/m0xx/m0:4.1.2/JZO54K/I9300XXELLA:user/release-keys'
01-13 21:21:56.471 2577 2577 I DEBUG : pid: 30943, tid: 847, name: Visualizer >>> com.iq.android <<<
01-13 21:21:56.471 2577 2577 I DEBUG : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 44a00000
01-13 21:21:56.951 2577 2577 I DEBUG : r0 5ae37ed0 r1 00010000 r2 00000000 r3 00000000
01-13 21:21:56.951 2577 2577 I DEBUG : r4 44a00000 r5 60ecde48 r6 40bb4f54 r7 60ecde50
01-13 21:21:56.956 2577 2577 I DEBUG : r8 5ae37ed0 r9 60ecde20 sl 40125a6c fp 00000001
01-13 21:21:56.956 2577 2577 I DEBUG : ip 40bb6bb0 sp 60ecde00 lr 40b8ac2d pc 44a00000 cpsr 40000010
01-13 21:21:56.956 2577 2577 I DEBUG : d0 000000c843480000 d1 0000000043480000
01-13 21:21:56.956 2577 2577 I DEBUG : d2 0000000000000000 d3 44a0000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d4 0000009200000000 d5 44a0000044340000
01-13 21:21:56.956 2577 2577 I DEBUG : d6 449fe0004433c000 d7 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d8 0000000043020000 d9 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d10 0000000000000000 d11 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d12 0000000000000000 d13 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d14 0000000000000000 d15 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d16 7fffffffffffffff d17 7fffffffffffffff
01-13 21:21:56.956 2577 2577 I DEBUG : d18 0000000000000000 d19 20000008409dbe40
01-13 21:21:56.956 2577 2577 I DEBUG : d20 3ffe000000000000 d21 3fee000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d22 0000000000000000 d23 3fee000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d24 3ff0000000000000 d25 0000000000000000
01-13 21:21:56.956 2577 2577 I DEBUG : d26 0000000000000000 d27 0000000000000000
01-13 21:21:56.961 2577 2577 I DEBUG : d28 0000000000000000 d29 0000000000000000
01-13 21:21:56.961 2577 2577 I DEBUG : d30 0000000000000000 d31 0000000000000000
01-13 21:21:56.961 2577 2577 I DEBUG : scr 20000013
01-13 21:21:56.966 2577 2577 I DEBUG :
01-13 21:21:56.966 2577 2577 I DEBUG : backtrace:
01-13 21:21:56.966 2577 2577 I DEBUG : #00 pc 01b26000 /dev/ashmem/dalvik-heap (deleted)
01-13 21:21:56.966 2577 2577 I DEBUG : #01 pc 0005ec2b /system/lib/libmedia.so (android::Visualizer::getWaveForm(unsigned char*)+36)
01-13 21:21:56.966 2577 2577 I DEBUG : #02 pc 0005edf9 /system/lib/libmedia.so (android::Visualizer::periodicCapture()+80)
01-13 21:21:56.966 2577 2577 I DEBUG : #03 pc 0005ee87 /system/lib/libmedia.so (android::Visualizer::CaptureThread::threadLoop()+14)
01-13 21:21:56.966 2577 2577 I DEBUG : #04 pc 0001104f /system/lib/libutils.so (android::Thread::_threadLoop(void*)+114)
01-13 21:21:56.966 2577 2577 I DEBUG : #05 pc 0004bc2b /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+66)
01-13 21:21:56.966 2577 2577 I DEBUG : #06 pc 00010bb5 /system/lib/libutils.so
01-13 21:21:56.971 2577 2577 I DEBUG : #07 pc 00012e00 /system/lib/libc.so (__thread_entry+48)
01-13 21:21:56.971 2577 2577 I DEBUG : #08 pc 00012558 /system/lib/libc.so (pthread_create+172)
谢谢你的任何建议。