From a901163af3b78b5e577df0ae90937ee011a77f8b Mon Sep 17 00:00:00 2001 From: Nekojimi Date: Thu, 4 Apr 2024 12:57:18 +0100 Subject: [PATCH] Retry opening audio streams after all exceptions, not just IO failure. --- src/main/java/moe/nekojimi/chords/TrackPlayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/moe/nekojimi/chords/TrackPlayer.java b/src/main/java/moe/nekojimi/chords/TrackPlayer.java index 0472f26..226f161 100644 --- a/src/main/java/moe/nekojimi/chords/TrackPlayer.java +++ b/src/main/java/moe/nekojimi/chords/TrackPlayer.java @@ -26,7 +26,7 @@ public class TrackPlayer implements Closeable private static final int DESIRED_BUFFER_SIZE = 3840 * 500; private static final int MAX_READ_FAILS = 3; - private static final int RETRY_COUNT = 10; + private static final int RETRY_COUNT = 8; private static final int RETRY_DELAY = 100; private final CircularByteBuffer audioBuffer = new CircularByteBuffer(3840 * 1024); @@ -47,7 +47,7 @@ public class TrackPlayer implements Closeable decodedFormat = AudioSendHandler.INPUT_FORMAT; break; // it worked! - } catch (IOException ex) + } catch (Exception ex) { try {