diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 4a1047eb2..64f6ec774 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -972,17 +972,18 @@ public class DownloadService extends Service { // Get duration MediaMetadataRetriever mmr = new MediaMetadataRetriever(); - mmr.setDataSource(media.getFile_url()); - String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); + String durationStr = null; try { + mmr.setDataSource(media.getFile_url()); + durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); media.setDuration(Integer.parseInt(durationStr)); Log.d(TAG, "Duration of file is " + media.getDuration()); } catch (NumberFormatException e) { Log.d(TAG, "Invalid file duration: " + durationStr); + } catch(Exception e) { + Log.e(TAG, "Get duration failed", e); } finally { - if (mmr != null) { - mmr.release(); - } + mmr.release(); } final FeedItem item = media.getItem();