From f5d015e8f94a55dc2097381b050215afb507c088 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 18 Jun 2021 20:18:24 +0200 Subject: [PATCH] Use ExoPlayer default values for buffers --- .../newpipe/player/helper/LoadController.java | 12 +++++------- .../newpipe/player/helper/PlayerHelper.java | 16 ---------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/LoadController.java b/app/src/main/java/org/schabi/newpipe/player/helper/LoadController.java index e4ae27750..71cfcc818 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/LoadController.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/LoadController.java @@ -20,18 +20,16 @@ public class LoadController implements LoadControl { //////////////////////////////////////////////////////////////////////////*/ public LoadController() { - this(PlayerHelper.getPlaybackStartBufferMs(), - PlayerHelper.getPlaybackMinimumBufferMs(), - PlayerHelper.getPlaybackOptimalBufferMs()); + this(PlayerHelper.getPlaybackStartBufferMs()); } - private LoadController(final int initialPlaybackBufferMs, - final int minimumPlaybackBufferMs, - final int optimalPlaybackBufferMs) { + private LoadController(final int initialPlaybackBufferMs) { this.initialPlaybackBufferUs = initialPlaybackBufferMs * 1000; final DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder(); - builder.setBufferDurationsMs(minimumPlaybackBufferMs, optimalPlaybackBufferMs, + builder.setBufferDurationsMs( + DefaultLoadControl.DEFAULT_MIN_BUFFER_MS, + DefaultLoadControl.DEFAULT_MAX_BUFFER_MS, initialPlaybackBufferMs, DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS); internalLoadControl = builder.build(); diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index d60a14381..b19e6e823 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -307,22 +307,6 @@ public final class PlayerHelper { return 500; } - /** - * @return the minimum number of milliseconds the player always buffers to - * after starting playback. - */ - public static int getPlaybackMinimumBufferMs() { - return 25000; - } - - /** - * @return the maximum/optimal number of milliseconds the player will buffer to once the buffer - * hits the point of {@link #getPlaybackMinimumBufferMs()}. - */ - public static int getPlaybackOptimalBufferMs() { - return 60000; - } - public static TrackSelection.Factory getQualitySelector() { return new AdaptiveTrackSelection.Factory( 1000,