Commit dc83de99 by krocard Committed by Ian Baker

Make DRM code removable from ProgressiveMediaSource

Add a constructor that takes a DrmSessionManagerProvider.
This allows R8 to strip the default implementation.

#minor-release

PiperOrigin-RevId: 425330083
parent 82ee8263
...@@ -90,11 +90,38 @@ public final class ProgressiveMediaSource extends BaseMediaSource ...@@ -90,11 +90,38 @@ public final class ProgressiveMediaSource extends BaseMediaSource
public Factory( public Factory(
DataSource.Factory dataSourceFactory, DataSource.Factory dataSourceFactory,
ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory) { ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory) {
this(
dataSourceFactory,
progressiveMediaExtractorFactory,
new DefaultDrmSessionManagerProvider(),
new DefaultLoadErrorHandlingPolicy(),
DEFAULT_LOADING_CHECK_INTERVAL_BYTES);
}
/**
* Creates a new factory for {@link ProgressiveMediaSource}s.
*
* @param dataSourceFactory A factory for {@link DataSource}s to read the media.
* @param progressiveMediaExtractorFactory A factory for the {@link ProgressiveMediaExtractor}
* to extract media from its container.
* @param drmSessionManagerProvider A provider to obtain a {@link DrmSessionManager} for a
* {@link MediaItem}.
* @param loadErrorHandlingPolicy A policy to handle load error.
* @param continueLoadingCheckIntervalBytes The number of bytes that should be loaded between
* each invocation of {@link
* MediaPeriod.Callback#onContinueLoadingRequested(SequenceableLoader)}.
*/
public Factory(
DataSource.Factory dataSourceFactory,
ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory,
DrmSessionManagerProvider drmSessionManagerProvider,
LoadErrorHandlingPolicy loadErrorHandlingPolicy,
int continueLoadingCheckIntervalBytes) {
this.dataSourceFactory = dataSourceFactory; this.dataSourceFactory = dataSourceFactory;
this.progressiveMediaExtractorFactory = progressiveMediaExtractorFactory; this.progressiveMediaExtractorFactory = progressiveMediaExtractorFactory;
drmSessionManagerProvider = new DefaultDrmSessionManagerProvider(); this.drmSessionManagerProvider = drmSessionManagerProvider;
loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy(); this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
continueLoadingCheckIntervalBytes = DEFAULT_LOADING_CHECK_INTERVAL_BYTES; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
} }
/** /**
......
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