Merge pull request #6515 from Redirion/buffersharmonization

Use ExoPlayer default values for buffers
pull/7014/head
Robin 2021-08-29 17:44:43 +02:00 zatwierdzone przez GitHub
commit 8bfd380b89
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 5 dodań i 23 usunięć

Wyświetl plik

@ -20,18 +20,16 @@ public class LoadController implements LoadControl {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
public LoadController() { public LoadController() {
this(PlayerHelper.getPlaybackStartBufferMs(), this(PlayerHelper.getPlaybackStartBufferMs());
PlayerHelper.getPlaybackMinimumBufferMs(),
PlayerHelper.getPlaybackOptimalBufferMs());
} }
private LoadController(final int initialPlaybackBufferMs, private LoadController(final int initialPlaybackBufferMs) {
final int minimumPlaybackBufferMs,
final int optimalPlaybackBufferMs) {
this.initialPlaybackBufferUs = initialPlaybackBufferMs * 1000; this.initialPlaybackBufferUs = initialPlaybackBufferMs * 1000;
final DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder(); final DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder();
builder.setBufferDurationsMs(minimumPlaybackBufferMs, optimalPlaybackBufferMs, builder.setBufferDurationsMs(
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
DefaultLoadControl.DEFAULT_MAX_BUFFER_MS,
initialPlaybackBufferMs, initialPlaybackBufferMs,
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS); DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);
internalLoadControl = builder.build(); internalLoadControl = builder.build();

Wyświetl plik

@ -307,22 +307,6 @@ public final class PlayerHelper {
return 500; 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() { public static TrackSelection.Factory getQualitySelector() {
return new AdaptiveTrackSelection.Factory( return new AdaptiveTrackSelection.Factory(
1000, 1000,