From 82bbd95691901477bb4ea38df652f06d251b7c28 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 2 Jun 2014 22:15:13 -0700 Subject: OOM: Don't even create a bitmap for DownloadFile get cover art --- src/github/daneren2005/dsub/service/DownloadFile.java | 8 +------- src/github/daneren2005/dsub/service/RESTMusicService.java | 7 ++++++- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java index 4af85975..1f962707 100644 --- a/src/github/daneren2005/dsub/service/DownloadFile.java +++ b/src/github/daneren2005/dsub/service/DownloadFile.java @@ -495,13 +495,7 @@ public class DownloadFile implements BufferFile { // Check if album art already exists, don't want to needlessly load into memory File albumArtFile = FileUtil.getAlbumArtFile(context, song); if(!albumArtFile.exists()) { - DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - int size = Math.min(metrics.widthPixels, metrics.heightPixels); - Bitmap bitmap = musicService.getCoverArt(context, song, size, null); - // Not being used, get rid of it immediately - if(bitmap != null) { - bitmap.recycle(); - } + musicService.getCoverArt(context, song, 0, null); } } } catch (Exception x) { diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 47437df3..eeddcaa2 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -677,7 +677,12 @@ public class RESTMusicService implements MusicService { Util.close(out); } - return FileUtil.getSampledBitmap(bytes, size); + // Size == 0 -> only want to download + if(size == 0) { + return null; + } else { + return FileUtil.getSampledBitmap(bytes, size); + } } finally { Util.close(in); } -- cgit v1.2.3