From b3db8c9549138bbbaba48be52740fa4a285767e8 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sun, 31 May 2020 14:06:22 +0200 Subject: [PATCH] Do not remove items generating errors form queue --- .../org/schabi/newpipe/player/BasePlayer.java | 12 +----------- .../newpipe/player/playqueue/PlayQueue.java | 19 +++++-------------- .../player/playqueue/PlayQueueAdapter.java | 3 --- .../player/playqueue/events/ErrorEvent.java | 8 +------- 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index f5a669788..85a30e3ed 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -64,7 +64,6 @@ import org.schabi.newpipe.player.helper.LoadController; import org.schabi.newpipe.player.helper.MediaSessionManager; import org.schabi.newpipe.player.helper.PlayerDataSource; import org.schabi.newpipe.player.helper.PlayerHelper; -import org.schabi.newpipe.player.mediasource.FailedMediaSource; import org.schabi.newpipe.player.playback.BasePlayerMediaSession; import org.schabi.newpipe.player.playback.CustomTrackSelector; import org.schabi.newpipe.player.playback.MediaSourceManager; @@ -77,7 +76,6 @@ import org.schabi.newpipe.util.ImageDisplayConstants; import org.schabi.newpipe.util.SerializedCache; import java.io.IOException; -import java.net.UnknownHostException; import io.reactivex.Observable; import io.reactivex.disposables.CompositeDisposable; @@ -835,16 +833,8 @@ public abstract class BasePlayer implements final Throwable cause = error.getCause(); if (error instanceof BehindLiveWindowException) { reload(); - } else if (cause instanceof UnknownHostException) { - playQueue.error(/*isNetworkProblem=*/true); - } else if (isCurrentWindowValid()) { - playQueue.error(/*isTransitioningToBadStream=*/true); - } else if (cause instanceof FailedMediaSource.MediaSourceResolutionException) { - playQueue.error(/*recoverableWithNoAvailableStream=*/false); - } else if (cause instanceof FailedMediaSource.StreamInfoLoadException) { - playQueue.error(/*recoverableIfLoadFailsWhenNetworkIsFine=*/false); } else { - playQueue.error(/*noIdeaWhatHappenedAndLetUserChooseWhatToDo=*/true); + playQueue.error(); } } diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java index 7de1d6422..7391294ba 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java @@ -305,25 +305,16 @@ public abstract class PlayQueue implements Serializable { } /** - * Report an exception for the item at the current index in order and the course of action: - * if the error can be skipped or the current item should be removed. + * Report an exception for the item at the current index in order and skip to the next one *

* This is done as a separate event as the underlying manager may have * different implementation regarding exceptions. *

- * - * @param skippable whether the error could be skipped */ - public synchronized void error(final boolean skippable) { - final int index = getIndex(); - - if (skippable) { - queueIndex.incrementAndGet(); - } else { - removeInternal(index); - } - - broadcast(new ErrorEvent(index, getIndex(), skippable)); + public synchronized void error() { + final int oldIndex = getIndex(); + queueIndex.incrementAndGet(); + broadcast(new ErrorEvent(oldIndex, getIndex())); } private synchronized void removeInternal(final int removeIndex) { diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueAdapter.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueAdapter.java index bf1361fc5..f8777597a 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueAdapter.java @@ -115,9 +115,6 @@ public class PlayQueueAdapter extends RecyclerView.Adapter