Commit c16d0f6c by tonihei Committed by Oliver Woodman

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
parent 26a27944
...@@ -265,6 +265,9 @@ ...@@ -265,6 +265,9 @@
([#5749](https://github.com/google/ExoPlayer/issues/5749)). ([#5749](https://github.com/google/ExoPlayer/issues/5749)).
* Add option to set preferred text role flags using * Add option to set preferred text role flags using
`DefaultTrackSelector.ParametersBuilder.setPreferredTextRoleFlags`. `DefaultTrackSelector.ParametersBuilder.setPreferredTextRoleFlags`.
* LoadControl:
* Default `prioritizeTimeOverSizeThresholds` to false to prevent OOM errors
([#6647](https://github.com/google/ExoPlayer/issues/6647)).
* Android 10: * Android 10:
* Set `compileSdkVersion` to 29 to enable use of Android 10 APIs. * Set `compileSdkVersion` to 29 to enable use of Android 10 APIs.
* Expose new `isHardwareAccelerated`, `isSoftwareOnly` and `isVendor` flags * Expose new `isHardwareAccelerated`, `isSoftwareOnly` and `isVendor` flags
......
...@@ -57,7 +57,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -57,7 +57,7 @@ public class DefaultLoadControl implements LoadControl {
public static final int DEFAULT_TARGET_BUFFER_BYTES = C.LENGTH_UNSET; public static final int DEFAULT_TARGET_BUFFER_BYTES = C.LENGTH_UNSET;
/** The default prioritization of buffer time constraints over size constraints. */ /** 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. */ /** The default back buffer duration in milliseconds. */
public static final int DEFAULT_BACK_BUFFER_DURATION_MS = 0; public static final int DEFAULT_BACK_BUFFER_DURATION_MS = 0;
...@@ -66,10 +66,10 @@ public class DefaultLoadControl implements LoadControl { ...@@ -66,10 +66,10 @@ public class DefaultLoadControl implements LoadControl {
public static final boolean DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME = false; public static final boolean DEFAULT_RETAIN_BACK_BUFFER_FROM_KEYFRAME = false;
/** A default size in bytes for a video buffer. */ /** 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. */ /** 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. */ /** A default size in bytes for a text buffer. */
public static final int DEFAULT_TEXT_BUFFER_SIZE = 2 * C.DEFAULT_BUFFER_SEGMENT_SIZE; public static final int DEFAULT_TEXT_BUFFER_SIZE = 2 * C.DEFAULT_BUFFER_SEGMENT_SIZE;
......
...@@ -68,8 +68,7 @@ public class DefaultLoadControlTest { ...@@ -68,8 +68,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void public void continueLoadingOnceBufferingStopped_andBufferAlmostEmpty_evenIfMinBufferNotReached() {
testContinueLoadingOnceBufferingStopped_andBufferAlmostEmpty_evenIfMinBufferNotReached() {
builder.setBufferDurationsMs( builder.setBufferDurationsMs(
/* minBufferMs= */ 0, /* minBufferMs= */ 0,
/* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US), /* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US),
...@@ -84,6 +83,7 @@ public class DefaultLoadControlTest { ...@@ -84,6 +83,7 @@ public class DefaultLoadControlTest {
@Test @Test
public void shouldContinueLoadingWithTargetBufferBytesReached_untilMinBufferReached() { public void shouldContinueLoadingWithTargetBufferBytesReached_untilMinBufferReached() {
builder.setPrioritizeTimeOverSizeThresholds(true);
builder.setBufferDurationsMs( builder.setBufferDurationsMs(
/* minBufferMs= */ (int) C.usToMs(MIN_BUFFER_US), /* minBufferMs= */ (int) C.usToMs(MIN_BUFFER_US),
/* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US), /* maxBufferMs= */ (int) C.usToMs(MAX_BUFFER_US),
...@@ -99,7 +99,8 @@ public class DefaultLoadControlTest { ...@@ -99,7 +99,8 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void shouldNeverContinueLoading_ifMaxBufferReachedAndNotPrioritizeTimeOverSize() { public void
shouldContinueLoading_withTargetBufferBytesReachedAndNotPrioritizeTimeOverSize_returnsTrueAsSoonAsTargetBufferReached() {
builder.setPrioritizeTimeOverSizeThresholds(false); builder.setPrioritizeTimeOverSizeThresholds(false);
createDefaultLoadControl(); createDefaultLoadControl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment