Skip to content

Commit

Permalink
Disable tunneling on internal Surface related Exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin committed Jan 3, 2023
1 parent eea4f0f commit 6df1dc1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
Expand Down Expand Up @@ -1430,6 +1431,19 @@ public void onPlayerError(@NonNull final PlaybackException error) {
reloadPlayQueueManager();
break;
default:
// Try to handle tunneling related exceptions
ExoPlaybackException epe = !exoPlayerIsNull() ?
simpleExoPlayer.getPlayerError() : null;
if(epe != null && epe.type == ExoPlaybackException.TYPE_UNEXPECTED &&
simpleExoPlayer.isTunnelingEnabled() &&
Log.getStackTraceString(epe.getUnexpectedException()).contains("Surface")) {
trackSelector.setParameters(trackSelector.buildUponParameters()
.setTunnelingEnabled(false));
// Reload playback on unexpected errors:
setRecovery();
reloadPlayQueueManager();
break;
}
// API, remote and renderer errors belong here:
onPlaybackShutdown();
break;
Expand Down

0 comments on commit 6df1dc1

Please sign in to comment.