【发布时间】:2017-11-05 08:37:17
【问题描述】:
我正在尝试提取歌曲缩略图。但是在提取其中一些之后 仅有的 致命信号 11 (SIGSEGV),代码 1,tid 13934 中的故障地址 0x40 引发此错误。请帮助我或给我另一种解决方案来提取歌曲缩略图。
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();
}
}
}
});
【问题讨论】: