Fix NaN comparison error.

This commit is contained in:
Oliver Woodman 2014-07-07 17:06:01 +01:00
parent 43b7efa986
commit f1213a7656

View File

@ -115,8 +115,8 @@ public class DefaultBandwidthMeter implements BandwidthMeter, TransferListener {
float bytesPerSecond = accumulator * 1000 / elapsedMs; float bytesPerSecond = accumulator * 1000 / elapsedMs;
slidingPercentile.addSample(computeWeight(accumulator), bytesPerSecond); slidingPercentile.addSample(computeWeight(accumulator), bytesPerSecond);
float bandwidthEstimateFloat = slidingPercentile.getPercentile(0.5f); float bandwidthEstimateFloat = slidingPercentile.getPercentile(0.5f);
bandwidthEstimate = bandwidthEstimateFloat == Float.NaN bandwidthEstimate = Float.isNaN(bandwidthEstimateFloat) ? NO_ESTIMATE
? NO_ESTIMATE : (long) bandwidthEstimateFloat; : (long) bandwidthEstimateFloat;
notifyBandwidthSample(elapsedMs, accumulator, bandwidthEstimate); notifyBandwidthSample(elapsedMs, accumulator, bandwidthEstimate);
} }
streamCount--; streamCount--;