From bf01ff0f60930427cb8a31e88fcad009d89132cc Mon Sep 17 00:00:00 2001 From: ibaker Date: Wed, 23 Oct 2019 16:20:12 +0100 Subject: [PATCH] Use Float.NaN for Cue#DIMEN_UNSET Float.MIN_VALUE is very close to zero: "A constant holding the smallest positive nonzero value of type float" https://developer.android.com/reference/java/lang/Float.html#MIN_VALUE Float.NaN more clearly conveys this is an invalid number, and will also more clearly carry over if we do maths on it accidentally. PiperOrigin-RevId: 276277784 --- .../src/main/java/com/google/android/exoplayer2/text/Cue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/text/Cue.java b/library/core/src/main/java/com/google/android/exoplayer2/text/Cue.java index 3dea9417c5..9aaa127819 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/text/Cue.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/text/Cue.java @@ -33,7 +33,8 @@ public class Cue { public static final Cue EMPTY = new Cue(""); /** An unset position or width. */ - public static final float DIMEN_UNSET = Float.MIN_VALUE; + // Note: We deliberately don't use Float.MIN_VALUE because it's positive & very close to zero. + public static final float DIMEN_UNSET = Float.NaN; /** * The type of anchor, which may be unset. One of {@link #TYPE_UNSET}, {@link #ANCHOR_TYPE_START},