Commit 2e8e8aba by olly Committed by Oliver Woodman

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
parent 6977c8f4
...@@ -40,11 +40,6 @@ import java.util.List; ...@@ -40,11 +40,6 @@ import java.util.List;
*/ */
public class ChunkTrackStream implements TrackStream, Loader.Callback { 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 Loader loader;
private final ChunkSource chunkSource; private final ChunkSource chunkSource;
private final LinkedList<BaseMediaChunk> mediaChunks; private final LinkedList<BaseMediaChunk> mediaChunks;
...@@ -76,23 +71,6 @@ public class ChunkTrackStream implements TrackStream, Loader.Callback { ...@@ -76,23 +71,6 @@ public class ChunkTrackStream implements TrackStream, Loader.Callback {
* null if delivery of events is not required. * 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 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. * @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.
* @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.
* @param minLoadableRetryCount The minimum number of times that the source should retry a load * @param minLoadableRetryCount The minimum number of times that the source should retry a load
* before propagating an error. * before propagating an error.
*/ */
......
...@@ -60,6 +60,12 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback { ...@@ -60,6 +60,12 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback {
private static final String TAG = "DashSampleSource"; 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 ManifestFetcher<MediaPresentationDescription> manifestFetcher;
private final DataSourceFactory dataSourceFactory; private final DataSourceFactory dataSourceFactory;
private final BandwidthMeter bandwidthMeter; private final BandwidthMeter bandwidthMeter;
...@@ -311,7 +317,7 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback { ...@@ -311,7 +317,7 @@ public final class DashSampleSource implements SampleSource, UtcTimingCallback {
trackGroups.get(selection.group), selectedTracks, dataSource, adaptiveEvaluator, trackGroups.get(selection.group), selectedTracks, dataSource, adaptiveEvaluator,
elapsedRealtimeOffset); elapsedRealtimeOffset);
ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize, ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize,
positionUs, eventHandler, eventListener, adaptationSetType); positionUs, eventHandler, eventListener, adaptationSetType, MIN_LOADABLE_RETRY_COUNT);
return Pair.create(chunkSource, trackStream); return Pair.create(chunkSource, trackStream);
} }
......
...@@ -53,6 +53,12 @@ import java.util.List; ...@@ -53,6 +53,12 @@ import java.util.List;
*/ */
public final class SmoothStreamingSampleSource implements SampleSource { 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 MINIMUM_MANIFEST_REFRESH_PERIOD_MS = 5000;
private static final int INITIALIZATION_VECTOR_SIZE = 8; private static final int INITIALIZATION_VECTOR_SIZE = 8;
...@@ -275,7 +281,7 @@ public final class SmoothStreamingSampleSource implements SampleSource { ...@@ -275,7 +281,7 @@ public final class SmoothStreamingSampleSource implements SampleSource {
streamElementIndex, trackGroups.get(selection.group), selectedTracks, dataSource, streamElementIndex, trackGroups.get(selection.group), selectedTracks, dataSource,
adaptiveEvaluator, trackEncryptionBoxes); adaptiveEvaluator, trackEncryptionBoxes);
ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize, ChunkTrackStream trackStream = new ChunkTrackStream(chunkSource, loadControl, bufferSize,
positionUs, eventHandler, eventListener, streamElementType); positionUs, eventHandler, eventListener, streamElementType, MIN_LOADABLE_RETRY_COUNT);
return Pair.create(chunkSource, trackStream); return Pair.create(chunkSource, trackStream);
} }
......
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