Skip to content

Commit

Permalink
Closes #750
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantcheese committed Feb 28, 2020
1 parent 8a67f8e commit fe18ce8
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ byte[] getCacheBytes() {
private long fileLength = C.LENGTH_UNSET;

private boolean prepared = false;
private boolean opened = false;

public WebmStreamingDataSource(@Nullable Uri uri, RawFile file, FileManager fileManager) {
super(/* isNetwork= */ true);
Expand Down Expand Up @@ -318,7 +317,7 @@ public long open(DataSpec dataSpec)
}

transferStarted(dataSpec);
opened = true;

return bytesRemaining;
}

Expand Down Expand Up @@ -349,7 +348,7 @@ public int read(byte[] buffer, int offset, int readLength)
return C.RESULT_END_OF_INPUT;
}

int readBytes = 0;
int readBytes;
int maxReadableBytes = (int) Math.min(bytesRemaining(), readLength);

Range<Long> cachedRange = activeRegionStats.findCachedRange(pos);
Expand Down Expand Up @@ -416,16 +415,10 @@ public void close()
throws IOException {
Logger.i(TAG, "close");
clearListeners();
try {
if (dataSource != null) {
dataSource.close();
dataSource = null;
}
} finally {
if (opened) {
opened = false;
transferEnded();
}
if (dataSource != null) {
dataSource.close();
transferEnded();
dataSource = null;
}
}

Expand Down

0 comments on commit fe18ce8

Please sign in to comment.