mirror of
https://github.com/androidx/media.git
synced 2025-05-18 04:59:54 +08:00
Fix ProgressiveMediaSource DefaultExtractorsFactory proguarding
PiperOrigin-RevId: 237900673
This commit is contained in:
parent
7bf963c06c
commit
7acc0ee798
@ -70,6 +70,11 @@
|
||||
* Update `DefaultTimeBar` based on duration of media and add parameter to set
|
||||
the minimum update interval to control the smoothness of the updates
|
||||
([#5040](https://github.com/google/ExoPlayer/issues/5040)).
|
||||
* Fix issue where using `ProgressiveMediaSource.Factory` would mean that
|
||||
`DefaultExtractorsFactory` would be kept by proguard. Custom
|
||||
`ExtractorsFactory` instances must now be passed via the
|
||||
`ProgressiveMediaSource.Factory` constructor, and `setExtractorsFactory` is
|
||||
deprecated.
|
||||
|
||||
### 2.9.6 ###
|
||||
|
||||
|
@ -87,8 +87,8 @@ public class FlacPlaybackTest {
|
||||
player.addListener(this);
|
||||
MediaSource mediaSource =
|
||||
new ProgressiveMediaSource.Factory(
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"))
|
||||
.setExtractorsFactory(MatroskaExtractor.FACTORY)
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"),
|
||||
MatroskaExtractor.FACTORY)
|
||||
.createMediaSource(uri);
|
||||
player.prepare(mediaSource);
|
||||
player.setPlayWhenReady(true);
|
||||
|
@ -87,8 +87,8 @@ public class OpusPlaybackTest {
|
||||
player.addListener(this);
|
||||
MediaSource mediaSource =
|
||||
new ProgressiveMediaSource.Factory(
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"))
|
||||
.setExtractorsFactory(MatroskaExtractor.FACTORY)
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"),
|
||||
MatroskaExtractor.FACTORY)
|
||||
.createMediaSource(uri);
|
||||
player.prepare(mediaSource);
|
||||
player.setPlayWhenReady(true);
|
||||
|
@ -120,8 +120,8 @@ public class VpxPlaybackTest {
|
||||
player.addListener(this);
|
||||
MediaSource mediaSource =
|
||||
new ProgressiveMediaSource.Factory(
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"))
|
||||
.setExtractorsFactory(MatroskaExtractor.FACTORY)
|
||||
new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"),
|
||||
MatroskaExtractor.FACTORY)
|
||||
.createMediaSource(uri);
|
||||
player
|
||||
.createMessage(videoRenderer)
|
||||
|
@ -49,7 +49,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
|
||||
private final DataSource.Factory dataSourceFactory;
|
||||
|
||||
@Nullable private ExtractorsFactory extractorsFactory;
|
||||
private ExtractorsFactory extractorsFactory;
|
||||
@Nullable private String customCacheKey;
|
||||
@Nullable private Object tag;
|
||||
private LoadErrorHandlingPolicy loadErrorHandlingPolicy;
|
||||
@ -57,12 +57,24 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
private boolean isCreateCalled;
|
||||
|
||||
/**
|
||||
* Creates a new factory for {@link ProgressiveMediaSource}s.
|
||||
* Creates a new factory for {@link ProgressiveMediaSource}s, using the extractors provided by
|
||||
* {@link DefaultExtractorsFactory}.
|
||||
*
|
||||
* @param dataSourceFactory A factory for {@link DataSource}s to read the media.
|
||||
*/
|
||||
public Factory(DataSource.Factory dataSourceFactory) {
|
||||
this(dataSourceFactory, new DefaultExtractorsFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new factory for {@link ProgressiveMediaSource}s.
|
||||
*
|
||||
* @param dataSourceFactory A factory for {@link DataSource}s to read the media.
|
||||
* @param extractorsFactory A factory for extractors used to extract media from its container.
|
||||
*/
|
||||
public Factory(DataSource.Factory dataSourceFactory, ExtractorsFactory extractorsFactory) {
|
||||
this.dataSourceFactory = dataSourceFactory;
|
||||
this.extractorsFactory = extractorsFactory;
|
||||
loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
|
||||
continueLoadingCheckIntervalBytes = DEFAULT_LOADING_CHECK_INTERVAL_BYTES;
|
||||
}
|
||||
@ -76,7 +88,11 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
* formats.
|
||||
* @return This factory, for convenience.
|
||||
* @throws IllegalStateException If one of the {@code create} methods has already been called.
|
||||
* @deprecated Pass the {@link ExtractorsFactory} via {@link #Factory(DataSource.Factory,
|
||||
* ExtractorsFactory)}. This is necessary so that proguard can treat the default extractors
|
||||
* factory as unused.
|
||||
*/
|
||||
@Deprecated
|
||||
public Factory setExtractorsFactory(ExtractorsFactory extractorsFactory) {
|
||||
Assertions.checkState(!isCreateCalled);
|
||||
this.extractorsFactory = extractorsFactory;
|
||||
@ -153,9 +169,6 @@ public final class ProgressiveMediaSource extends BaseMediaSource
|
||||
@Override
|
||||
public ProgressiveMediaSource createMediaSource(Uri uri) {
|
||||
isCreateCalled = true;
|
||||
if (extractorsFactory == null) {
|
||||
extractorsFactory = new DefaultExtractorsFactory();
|
||||
}
|
||||
return new ProgressiveMediaSource(
|
||||
uri,
|
||||
dataSourceFactory,
|
||||
|
Loading…
x
Reference in New Issue
Block a user