Open
Description
Unable to read a 28m file
When it go the "Mp3File mp3File = new Mp3File(path);" and the file's size out of 28m,it will throw the OutOfMemoryError
java.lang.OutOfMemoryError: Failed to allocate a 29770255 byte allocation with 6291456 free bytes and 16MB until OOM, max allowed footprint 39725816, growth limit 50331648
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at java.nio.DirectByteBuffer$MemoryRef.<init>(DirectByteBuffer.java:71)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:240)
at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:168)
at sun.nio.ch.IOUtil.read(IOUtil.java:195)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:187)
at com.mpatric.mp3agic.Mp3File.initCustomTag(Mp3File.java:313)
at com.mpatric.mp3agic.Mp3File.init(Mp3File.java:101)
at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:58)
at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:45)
at com.acloud.stub.localmusic.QtActivity.getMp3bytes(QtActivity.java:1522)
at com.acloud.stub.localmusic.QtActivity.lambda$loadArtistImageWithSongPath$1$QtActivity(QtActivity.java:1502)
at com.acloud.stub.localmusic.-$$Lambda$QtActivity$zqAHJFCvZ72ENomoa5ol6UnlrjE.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
private static byte[] getMp3bytes(String path) {
byte[] b = null;
Log.d(TAG, "getMp3bytes: =====path==>" + path);
try {
Mp3File mp3File = new Mp3File(path);
if (mp3File.hasId3v2Tag()) {
b = mp3File.getId3v2Tag().getAlbumImage();
if (b != null)
Log.d(TAG, "getMp3bytes: =======getMp3_pic_bytes_size==>" + b.length);
}
} catch (IOException | UnsupportedTagException | InvalidDataException |
IllegalArgumentException | OutOfMemoryError e) {
Log.e(TAG, "getMp3bytes: ", e);
}
return b;
}
Metadata
Assignees
Labels
No labels
Activity