From 64b1566ad4230dd092e40e80a054288366bae051 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Tue, 29 Aug 2017 02:15:08 -0700 Subject: [PATCH] Use Math.abs in Sonic.java ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=166820970 --- .../main/java/com/google/android/exoplayer2/audio/Sonic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/Sonic.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/Sonic.java index ef7877ae1e..5c5ac06da3 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/Sonic.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/Sonic.java @@ -241,7 +241,7 @@ import java.util.Arrays; for (int i = 0; i < period; i++) { short sVal = samples[position + i]; short pVal = samples[position + period + i]; - diff += sVal >= pVal ? sVal - pVal : pVal - sVal; + diff += Math.abs(sVal - pVal); } // Note that the highest number of samples we add into diff will be less than 256, since we // skip samples. Thus, diff is a 24 bit number, and we can safely multiply by numSamples