Always inject loadable retry count.
Now [DASH/SS]SampleSource instances are creating ChunkTrackStream instances dynamically, it makes sense to always require that the min retry count be injected from that level. The SampleSource implementations should also use the retry count when refreshing the manifest. The option to configure the retry count on the SampleSource classes will arrive in a later CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122424774
This commit is contained in:
parent
6977c8f455
commit
2e8e8aba9d
@ -40,11 +40,6 @@ import java.util.List;
|
||||
*/
|
||||
public class ChunkTrackStream implements TrackStream, Loader.Callback {
|
||||
|
||||
/**
|
||||
* The default minimum number of times to retry loading data prior to failing.
|
||||
*/
|
||||
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT = 3;
|
||||
|
||||
private final Loader loader;
|
||||
private final ChunkSource chunkSource;
|
||||
private final LinkedList<BaseMediaChunk> mediaChunks;
|
||||
@ -67,23 +62,6 @@ public class ChunkTrackStream implements TrackStream, Loader.Callback {
|
||||
private boolean loadingFinished;
|
||||
private boolean released;
|
||||
|
||||
/**
|
||||
* @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
|
||||
* @param loadControl Controls when the source is permitted to load data.
|
||||
* @param bufferSizeContribution The contribution of this source to the media buffer, in bytes.
|
||||
* @param positionUs The position from which to start loading media.
|
||||
* @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
|
||||
* null if delivery of events is not required.
|
||||
* @param eventListener A listener of events. May be null if delivery of events is not required.
|
||||
* @param eventSourceId An identifier that gets passed to {@code eventListener} methods.
|
||||
*/
|
||||
public ChunkTrackStream(ChunkSource chunkSource, LoadControl loadControl,
|
||||
int bufferSizeContribution, long positionUs, Handler eventHandler,
|
||||
ChunkTrackStreamEventListener eventListener, int eventSourceId) {
|
||||
this(chunkSource, loadControl, bufferSizeContribution, positionUs, eventHandler, eventListener,
|
||||
eventSourceId, DEFAULT_MIN_LOADABLE_RETRY_COUNT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
|
||||
* @param loadControl Controls when the source is permitted to load data.
|
||||
|
@ -60,6 +60,12 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback {
|
||||
|
||||
private static final String TAG = "DashSampleSource";
|
||||
|
||||
/**
|
||||
* The minimum number of times to retry loading data prior to failing.
|
||||
*/
|
||||
// TODO: Use this for manifest loads as well.
|
||||
private static final int MIN_LOADABLE_RETRY_COUNT = 3;
|
||||
|
||||
private final ManifestFetcher<MediaPresentationDescription> manifestFetcher;
|
||||
private final DataSourceFactory dataSourceFactory;
|
||||
private final BandwidthMeter bandwidthMeter;
|
||||
@ -311,7 +317,7 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback {
|
||||
trackGroups.get(selection.group), selectedTracks, dataSource, adaptiveEvaluator,
|
||||
elapsedRealtimeOffset);
|
||||
ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize,
|
||||
positionUs, eventHandler, eventListener, adaptationSetType);
|
||||
positionUs, eventHandler, eventListener, adaptationSetType, MIN_LOADABLE_RETRY_COUNT);
|
||||
return Pair.create(chunkSource, trackStream);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,12 @@ import java.util.List;
|
||||
*/
|
||||
public final class SmoothStreamingSampleSource implements SampleSource {
|
||||
|
||||
/**
|
||||
* The minimum number of times to retry loading data prior to failing.
|
||||
*/
|
||||
// TODO: Use this for manifest loads as well.
|
||||
private static final int MIN_LOADABLE_RETRY_COUNT = 3;
|
||||
|
||||
private static final int MINIMUM_MANIFEST_REFRESH_PERIOD_MS = 5000;
|
||||
private static final int INITIALIZATION_VECTOR_SIZE = 8;
|
||||
|
||||
@ -275,7 +281,7 @@ public final class SmoothStreamingSampleSource implements SampleSource {
|
||||
streamElementIndex, trackGroups.get(selection.group), selectedTracks, dataSource,
|
||||
adaptiveEvaluator, trackEncryptionBoxes);
|
||||
ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize,
|
||||
positionUs, eventHandler, eventListener, streamElementType);
|
||||
positionUs, eventHandler, eventListener, streamElementType, MIN_LOADABLE_RETRY_COUNT);
|
||||
return Pair.create(chunkSource, trackStream);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user