Default prioritizeTimeOverSizeThresholds to false.

This prevents OOM errors for high bitrate streams that attempt to fill
the buffer regardless of the memory usage.

Also change the max buffer sizes to ensure this is a no-op for video
streams < 20Mbps and audio streams < 260kbps.

Issue:#6647
Issue:#7006
PiperOrigin-RevId: 300720299
This commit is contained in:
tonihei 2020-03-13 09:46:01 +00:00 committed by Oliver Woodman
parent 26a27944c5
commit c16d0f6c5d
3 changed files with 10 additions and 6 deletions

View File

@ -265,6 +265,9 @@
([#5749](https://github.com/google/ExoPlayer/issues/5749)).
* Add option to set preferred text role flags using
`DefaultTrackSelector.ParametersBuilder.setPreferredTextRoleFlags`.
* LoadControl:
* Default `prioritizeTimeOverSizeThresholds` to false to prevent OOM errors
([#6647](https://github.com/google/ExoPlayer/issues/6647)).
* Android 10:
* Set `compileSdkVersion` to 29 to enable use of Android 10 APIs.
* Expose new `isHardwareAccelerated`, `isSoftwareOnly` and `isVendor` flags

View File

@ -57,7 +57,7 @@ public class DefaultLoadControl implements LoadControl {
public static final int DEFAULT_TARGET_BUFFER_BYTES = C.LENGTH_UNSET;
/** The default prioritization of buffer time constraints over size constraints. */
public static final boolean DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS = true;
public static final boolean DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS = false;
/** The default back buffer duration in milliseconds. */
public static final int DEFAULT_BACK_BUFFER_DURATION_MS = 0;
@ -66,10 +66,10 @@ public class DefaultLoadControl implements LoadControl {
public static final boolean DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME = false;
/** A default size in bytes for a video buffer. */
public static final int DEFAULT_VIDEO_BUFFER_SIZE = 500 * C.DEFAULT_BUFFER_SEGMENT_SIZE;
public static final int DEFAULT_VIDEO_BUFFER_SIZE = 2000 * C.DEFAULT_BUFFER_SEGMENT_SIZE;
/** A default size in bytes for an audio buffer. */
public static final int DEFAULT_AUDIO_BUFFER_SIZE = 54 * C.DEFAULT_BUFFER_SEGMENT_SIZE;
public static final int DEFAULT_AUDIO_BUFFER_SIZE = 200 * C.DEFAULT_BUFFER_SEGMENT_SIZE;
/** A default size in bytes for a text buffer. */
public static final int DEFAULT_TEXT_BUFFER_SIZE = 2 * C.DEFAULT_BUFFER_SEGMENT_SIZE;

View File

@ -68,8 +68,7 @@ public class DefaultLoadControlTest {
}
@Test
public void
testContinueLoadingOnceBufferingStopped_andBufferAlmostEmpty_evenIfMinBufferNotReached() {
public void continueLoadingOnceBufferingStopped_andBufferAlmostEmpty_evenIfMinBufferNotReached() {
builder.setBufferDurationsMs(
/* minBufferMs= */ 0,
/* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US),
@ -84,6 +83,7 @@ public class DefaultLoadControlTest {
@Test
public void shouldContinueLoadingWithTargetBufferBytesReached_untilMinBufferReached() {
builder.setPrioritizeTimeOverSizeThresholds(true);
builder.setBufferDurationsMs(
/* minBufferMs= */ (int) C.usToMs(MIN_BUFFER_US),
/* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US),
@ -99,7 +99,8 @@ public class DefaultLoadControlTest {
}
@Test
public void shouldNeverContinueLoading_ifMaxBufferReachedAndNotPrioritizeTimeOverSize() {
public void
shouldContinueLoading_withTargetBufferBytesReachedAndNotPrioritizeTimeOverSize_returnsTrueAsSoonAsTargetBufferReached() {
builder.setPrioritizeTimeOverSizeThresholds(false);
createDefaultLoadControl();