android - 致命信号 11 安卓可视化工具

标签 android fatal-error visualizer

我正在开发应用程序,在单击按钮播放所有后播放音频文件列表,播放每个文件后我从 https://github.com/felixpalmer/android-visualizer 重新创建一个新的 VisualizerView 问题:有时我会收到这个令人讨厌的 fatal error 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)

感谢您的任何建议。

最佳答案

我有一个非常相似的问题。每次打开新文件时,我都会创建一个新的 AudioTrack 并根据 session ID 构建一个新的 Visualizer。在带有 4.4.2 的 Nexus 7 上构建 Visualizer 后不久随机获得致命信号 11 和 6,但在带有 4.4.2 的 HTC One GPE 上却没有。

虽然丑陋且无法解释,但为我解决的是:

Thread.sleep(100)

在构建新的 Visualizer 之前,但在初始化 AudioTrack 之后(以及之前的 Visualizer 的 release())。 我欢迎更好的解决方案。

关于android - 致命信号 11 安卓可视化工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14302825/

相关文章:

java - Android:上传文件和填写POST正文一起

Android 传感器 ListView

Swift slider - fatal error : unexpectedly found nil while unwrapping an Optional value (lldb)

java - 使用fft进行处理

javascript - 色彩展示网站开发

android - 如何将 ActiveAndroid ORM 添加到 Gradle?

android - 更改微调器中所选项目的文本颜色

php - WordPress - PHP fatal error : Call to undefined function get_bloginfo()

php - fatal error : Call to a member function get_cart_contents_count() on a non-object in/functions. php 在第 413 行

c++ - PCL可视化错误