From 654d914bb65c8458d0c9713ac94f77164f7bee65 Mon Sep 17 00:00:00 2001 From: olly Date: Fri, 23 Sep 2016 05:35:42 -0700 Subject: [PATCH] Fix DefaultHttpDataSource read when requested length is 0 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=134063990 --- .../android/exoplayer2/upstream/DefaultHttpDataSource.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java b/library/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java index bcb4b9d2bd..e00f93aa19 100644 --- a/library/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java +++ b/library/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java @@ -547,11 +547,8 @@ public class DefaultHttpDataSource implements HttpDataSource { * @throws IOException If an error occurs reading from the source. */ private int readInternal(byte[] buffer, int offset, int readLength) throws IOException { - readLength = bytesToRead == C.LENGTH_UNSET ? readLength - : (int) Math.min(readLength, bytesToRead - bytesRead); if (readLength == 0) { - // We've read all of the requested data. - return C.RESULT_END_OF_INPUT; + return 0; } int read = inputStream.read(buffer, offset, readLength);