Propagate erors to ChunkSource implementations.
This can help custom ChunkSource implementations to act on this information. For example an adaptive implementation may choose to blacklist a problematic format if loads of that format keep failing.
This commit is contained in:
parent
4fd4c89518
commit
47c0bbd6b5
@ -430,6 +430,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Listener {
|
|||||||
currentLoadableExceptionCount++;
|
currentLoadableExceptionCount++;
|
||||||
currentLoadableExceptionTimestamp = SystemClock.elapsedRealtime();
|
currentLoadableExceptionTimestamp = SystemClock.elapsedRealtime();
|
||||||
notifyUpstreamError(e);
|
notifyUpstreamError(e);
|
||||||
|
chunkSource.onChunkLoadError(currentLoadableHolder.chunk, e);
|
||||||
updateLoadControl();
|
updateLoadControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,4 +100,13 @@ public interface ChunkSource {
|
|||||||
*/
|
*/
|
||||||
IOException getError();
|
IOException getError();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked when the {@link ChunkSampleSource} encounters an error loading a chunk obtained from
|
||||||
|
* this source.
|
||||||
|
*
|
||||||
|
* @param chunk The chunk whose load encountered the error.
|
||||||
|
* @param e The error.
|
||||||
|
*/
|
||||||
|
void onChunkLoadError(Chunk chunk, Exception e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -102,4 +102,9 @@ public class MultiTrackChunkSource implements ChunkSource, ExoPlayerComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkLoadError(Chunk chunk, Exception e) {
|
||||||
|
selectedSource.onChunkLoadError(chunk, e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -192,6 +192,11 @@ public class DashMp4ChunkSource implements ChunkSource {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkLoadError(Chunk chunk, Exception e) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
private static Chunk newInitializationChunk(Representation representation,
|
private static Chunk newInitializationChunk(Representation representation,
|
||||||
FragmentedMp4Extractor extractor, DataSource dataSource, int trigger) {
|
FragmentedMp4Extractor extractor, DataSource dataSource, int trigger) {
|
||||||
DataSpec dataSpec = new DataSpec(representation.uri, 0, representation.indexEnd + 1,
|
DataSpec dataSpec = new DataSpec(representation.uri, 0, representation.indexEnd + 1,
|
||||||
|
@ -173,6 +173,11 @@ public class DashWebmChunkSource implements ChunkSource {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkLoadError(Chunk chunk, Exception e) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
private static Chunk newInitializationChunk(Representation representation,
|
private static Chunk newInitializationChunk(Representation representation,
|
||||||
WebmExtractor extractor, DataSource dataSource, int trigger) {
|
WebmExtractor extractor, DataSource dataSource, int trigger) {
|
||||||
DataSpec dataSpec = new DataSpec(representation.uri, 0, representation.indexEnd + 1,
|
DataSpec dataSpec = new DataSpec(representation.uri, 0, representation.indexEnd + 1,
|
||||||
|
@ -196,6 +196,11 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkLoadError(Chunk chunk, Exception e) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
private static MediaFormat getMediaFormat(StreamElement streamElement, int trackIndex) {
|
private static MediaFormat getMediaFormat(StreamElement streamElement, int trackIndex) {
|
||||||
TrackElement trackElement = streamElement.tracks[trackIndex];
|
TrackElement trackElement = streamElement.tracks[trackIndex];
|
||||||
String mimeType = trackElement.mimeType;
|
String mimeType = trackElement.mimeType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user