mirror of
https://github.com/androidx/media.git
synced 2025-05-03 21:57:46 +08:00
Make FileDataSource throw EOFException.
This commit is contained in:
parent
362dc5f382
commit
cfcbca6c95
@ -17,6 +17,7 @@ package com.google.android.exoplayer.upstream;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
@ -65,6 +66,9 @@ public final class FileDataSource implements DataSource {
|
||||
file.seek(dataSpec.position);
|
||||
bytesRemaining = dataSpec.length == C.LENGTH_UNBOUNDED ? file.length() - dataSpec.position
|
||||
: dataSpec.length;
|
||||
if (bytesRemaining < 0) {
|
||||
throw new EOFException();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new FileDataSourceException(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user