From d3ecbf75b2b70d81dd6030baf29baaf9c58d2343 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 20 Dec 2018 14:00:03 +0000 Subject: [PATCH] Fix buffer size for renderers with TRACK_TYPE_NONE This includes NoSampleRenderers. PiperOrigin-RevId: 226323693 --- .../java/com/google/android/exoplayer2/util/Util.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/core/src/main/java/com/google/android/exoplayer2/util/Util.java index 7bea5de8ba..1e1153d367 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -1481,11 +1481,12 @@ public final class Util { } /** - * Maps a {@link C} {@code TRACK_TYPE_*} constant to the corresponding {@link C} - * {@code DEFAULT_*_BUFFER_SIZE} constant. + * Maps a {@link C} {@code TRACK_TYPE_*} constant to the corresponding {@link C} {@code + * DEFAULT_*_BUFFER_SIZE} constant. * * @param trackType The track type. * @return The corresponding default buffer size in bytes. + * @throws IllegalArgumentException If the track type is an unrecognized or custom track type. */ public static int getDefaultBufferSize(int trackType) { switch (trackType) { @@ -1501,8 +1502,10 @@ public final class Util { return C.DEFAULT_METADATA_BUFFER_SIZE; case C.TRACK_TYPE_CAMERA_MOTION: return C.DEFAULT_CAMERA_MOTION_BUFFER_SIZE; + case C.TRACK_TYPE_NONE: + return 0; default: - throw new IllegalStateException(); + throw new IllegalArgumentException(); } }