From 93b2a07811a0287e69a529fd219435b78145af95 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 13 May 2021 18:17:20 +0200 Subject: [PATCH] Disable ExoPlayer id3 extraction Malformed audio files can cause a crash in ExoPlayer. We have our own id3 extractor and don't use the data of ExoPlayer, so we can just disable parsing in ExoPlayer. This reduces the number locations where something can go wrong that prevents playback. --- .../antennapod/core/service/playback/ExoPlayerWrapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java index 8d3633b24..0d289bee6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java @@ -16,6 +16,7 @@ import com.google.android.exoplayer2.SeekParameters; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; +import com.google.android.exoplayer2.extractor.mp3.Mp3Extractor; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.TrackGroupArray; @@ -210,6 +211,7 @@ public class ExoPlayerWrapper implements IPlayer { DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, null, httpDataSourceFactory); DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory(); extractorsFactory.setConstantBitrateSeekingEnabled(true); + extractorsFactory.setMp3ExtractorFlags(Mp3Extractor.FLAG_DISABLE_ID3_METADATA); ProgressiveMediaSource.Factory f = new ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory); mediaSource = f.createMediaSource(Uri.parse(s)); }