Skip to content

Commit

Permalink
(#750) Revert webm streaming to the working state
Browse files Browse the repository at this point in the history
  • Loading branch information
K1rakishou committed Feb 28, 2020
1 parent 7573246 commit 2aa1914
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ 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 @@ -311,13 +312,13 @@ public long open(DataSpec dataSpec)
activeRegionStats = partialFileCache.getRegionStats(new Range<>(pos, end));
httpActiveRange = null;

Logger.i(TAG, "bytes remaining: " + bytesRemaining);
if (bytesRemaining < 0) {
throw new EOFException();
}

transferStarted(dataSpec);

opened = true;

return bytesRemaining;
}

Expand Down Expand Up @@ -411,14 +412,16 @@ public Uri getUri() {
}

@Override
public void close()
throws IOException {
Logger.i(TAG, "close");
clearListeners();
if (dataSource != null) {
dataSource.close();
transferEnded();
dataSource = null;
public void close() throws IOException {
try {
if (dataSource != null) {
dataSource.close();
}
} finally {
if (opened) {
opened = false;
transferEnded();
}
}
}

Expand Down

0 comments on commit 2aa1914

Please sign in to comment.