summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-09-08 12:06:20 +0200
committerGitHub <noreply@github.com>2024-09-08 12:06:20 +0200
commit5ea92f68b1cd964f42a0c621d81ea873ca73e75d (patch)
tree1ef094c884ab18bbf323b12db2371bbf82f9187c
parentf32d5ccb30f5e346cdf2c6c4a674f8e600a42a92 (diff)
downloadAntennaPod-5ea92f68b1cd964f42a0c621d81ea873ca73e75d.zip
Catch crash when device does not support LoudnessEnhancer properly (#7390)
-rw-r--r--playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
index 9816c2231..bdeca417a 100644
--- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
+++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/ExoPlayerWrapper.java
@@ -399,11 +399,15 @@ public class ExoPlayerWrapper {
LoudnessEnhancer newEnhancer = new LoudnessEnhancer(audioStreamId);
LoudnessEnhancer oldEnhancer = this.loudnessEnhancer;
if (oldEnhancer != null) {
- newEnhancer.setEnabled(oldEnhancer.getEnabled());
- if (oldEnhancer.getEnabled()) {
- newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
+ try {
+ newEnhancer.setEnabled(oldEnhancer.getEnabled());
+ if (oldEnhancer.getEnabled()) {
+ newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
+ }
+ oldEnhancer.release();
+ } catch (Exception e) {
+ Log.d(TAG, e.toString());
}
- oldEnhancer.release();
}
this.loudnessEnhancer = newEnhancer;