致命信号11(SIGSEGV),代码1,tid 13934中的故障地址0x40

时间:2017-06-04 12:44:13

标签: java android layout

我正在尝试提取歌曲缩略图。但在提取了一些之后 只要 致命信号11(SIGSEGV),代码1,故障地址0x40在tid 13934这个错误引发。请帮助我或者给我另一个解决方案来提取歌曲缩略图。

   Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < arrayList.size(); i++) {
                    Log.i("Number",String.valueOf(i));
                    Bitmap bitmap;
                    byte[] buffer;
                    try {
                        FFmpegMediaMetadataRetriever fFmpegMediaMetadataRetriever = new FFmpegMediaMetadataRetriever();
                        fFmpegMediaMetadataRetriever.setDataSource(arrayList.get(i));
                        buffer = fFmpegMediaMetadataRetriever.getEmbeddedPicture();
                    } catch (RuntimeException e) {
                        buffer = null;
                    }

                    if (buffer != null) {
                        bitmap = resizeBitmap.resizeBitmap(buffer, 100, 100);
                    } else bitmap = null;

                    try {
                        File fos = new File(s + "/MyApp/data/thumbs", "image" + i + ".jpg");
                        if (!fos.exists()) {
                            fos.createNewFile();
                        }

                        if (bitmap != null) {
                            FileOutputStream fileOutputStream = new FileOutputStream(fos);
                            if (!fos.exists()) fos.createNewFile();
                            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
                            fileOutputStream.close();
                        }

                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                }
            }
        });

1 个答案:

答案 0 :(得分:0)

在大多数情况下,您会收到此SIGNAL错误,因为您的图像格式与解码器不匹配。确保使用正确的方法解码“ / MyApp / data / thumbs / image”。例如,了解您的图片是yuv还是jpeg。