Commit 6b123590 by Oliver Woodman

Correctly propagate errors

parent 643f33f7
...@@ -165,7 +165,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback { ...@@ -165,7 +165,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
@Override @Override
public int readData(int track, long playbackPositionUs, MediaFormatHolder formatHolder, public int readData(int track, long playbackPositionUs, MediaFormatHolder formatHolder,
SampleHolder sampleHolder, boolean onlyReadDiscontinuity) { SampleHolder sampleHolder, boolean onlyReadDiscontinuity) throws IOException {
Assertions.checkState(prepared); Assertions.checkState(prepared);
downstreamPositionUs = playbackPositionUs; downstreamPositionUs = playbackPositionUs;
...@@ -175,6 +175,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback { ...@@ -175,6 +175,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
} }
if (onlyReadDiscontinuity || isPendingReset() || extractors.isEmpty()) { if (onlyReadDiscontinuity || isPendingReset() || extractors.isEmpty()) {
if (currentLoadableException != null) {
throw currentLoadableException;
}
return NOTHING_READ; return NOTHING_READ;
} }
...@@ -192,6 +195,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback { ...@@ -192,6 +195,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
} }
if (!extractor.isPrepared()) { if (!extractor.isPrepared()) {
if (currentLoadableException != null) {
throw currentLoadableException;
}
return NOTHING_READ; return NOTHING_READ;
} }
...@@ -208,7 +214,14 @@ public class HlsSampleSource implements SampleSource, Loader.Callback { ...@@ -208,7 +214,14 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
return SAMPLE_READ; return SAMPLE_READ;
} }
return loadingFinished ? END_OF_STREAM : NOTHING_READ; if (loadingFinished) {
return END_OF_STREAM;
}
if (currentLoadableException != null) {
throw currentLoadableException;
}
return NOTHING_READ;
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment