diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-06-02 22:15:13 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-06-02 22:15:13 -0700 |
commit | 82bbd95691901477bb4ea38df652f06d251b7c28 (patch) | |
tree | b00be554981dbf2125e818fa3123c8e7bc64051d /src/github | |
parent | 1e451101e2982d6111fae78343f7d747231e64dd (diff) | |
download | dsub-82bbd95691901477bb4ea38df652f06d251b7c28.tar.gz dsub-82bbd95691901477bb4ea38df652f06d251b7c28.tar.bz2 dsub-82bbd95691901477bb4ea38df652f06d251b7c28.zip |
OOM: Don't even create a bitmap for DownloadFile get cover art
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadFile.java | 8 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/service/RESTMusicService.java | 7 |
2 files changed, 7 insertions, 8 deletions
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); } |