diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java index 9ff284512b..ad88861b3d 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java @@ -216,11 +216,13 @@ public final class DashMediaSource extends BaseMediaSource { * @return This factory, for convenience. */ public Factory setCompositeSequenceableLoaderFactory( - @Nullable CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { + CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { this.compositeSequenceableLoaderFactory = - compositeSequenceableLoaderFactory != null - ? compositeSequenceableLoaderFactory - : new DefaultCompositeSequenceableLoaderFactory(); + checkNotNull( + compositeSequenceableLoaderFactory, + "DashMediaSource.Factory#setCompositeSequenceableLoaderFactory no longer handles null" + + " by instantiating a new DefaultCompositeSequenceableLoaderFactory. Explicitly" + + " construct and pass an instance in order to retain the old behavior."); return this; } diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java index b5d5058b73..6f01b3641d 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java @@ -187,41 +187,40 @@ public final class HlsMediaSource extends BaseMediaSource } /** - * Sets the factory from which playlist parsers will be obtained. The default value is a {@link - * DefaultHlsPlaylistParserFactory}. + * Sets the factory from which playlist parsers will be obtained. * * @param playlistParserFactory An {@link HlsPlaylistParserFactory}. * @return This factory, for convenience. */ - public Factory setPlaylistParserFactory( - @Nullable HlsPlaylistParserFactory playlistParserFactory) { + public Factory setPlaylistParserFactory(HlsPlaylistParserFactory playlistParserFactory) { this.playlistParserFactory = - playlistParserFactory != null - ? playlistParserFactory - : new DefaultHlsPlaylistParserFactory(); + checkNotNull( + playlistParserFactory, + "HlsMediaSource.Factory#setPlaylistParserFactory no longer handles null by" + + " instantiating a new DefaultHlsPlaylistParserFactory. Explicitly" + + " construct and pass an instance in order to retain the old behavior."); return this; } /** - * Sets the {@link HlsPlaylistTracker} factory. The default value is {@link - * DefaultHlsPlaylistTracker#FACTORY}. + * Sets the {@link HlsPlaylistTracker} factory. * * @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances. * @return This factory, for convenience. */ - public Factory setPlaylistTrackerFactory( - @Nullable HlsPlaylistTracker.Factory playlistTrackerFactory) { + public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) { this.playlistTrackerFactory = - playlistTrackerFactory != null - ? playlistTrackerFactory - : DefaultHlsPlaylistTracker.FACTORY; + checkNotNull( + playlistTrackerFactory, + "HlsMediaSource.Factory#setPlaylistTrackerFactory no longer handles null by" + + " defaulting to DefaultHlsPlaylistTracker.FACTORY. Explicitly" + + " pass a reference to this instance in order to retain the old behavior."); return this; } /** * Sets the factory to create composite {@link SequenceableLoader}s for when this media source - * loads data from multiple streams (video, audio etc...). The default is an instance of {@link - * DefaultCompositeSequenceableLoaderFactory}. + * loads data from multiple streams (video, audio etc...). * * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams (video, @@ -229,11 +228,13 @@ public final class HlsMediaSource extends BaseMediaSource * @return This factory, for convenience. */ public Factory setCompositeSequenceableLoaderFactory( - @Nullable CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { + CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { this.compositeSequenceableLoaderFactory = - compositeSequenceableLoaderFactory != null - ? compositeSequenceableLoaderFactory - : new DefaultCompositeSequenceableLoaderFactory(); + checkNotNull( + compositeSequenceableLoaderFactory, + "HlsMediaSource.Factory#setCompositeSequenceableLoaderFactory no longer handles null" + + " by instantiating a new DefaultCompositeSequenceableLoaderFactory. Explicitly" + + " construct and pass an instance in order to retain the old behavior."); return this; } diff --git a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java index f6830ea37b..968f7e3e87 100644 --- a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java +++ b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java @@ -173,8 +173,7 @@ public final class SsMediaSource extends BaseMediaSource /** * Sets the factory to create composite {@link SequenceableLoader}s for when this media source - * loads data from multiple streams (video, audio etc.). The default is an instance of {@link - * DefaultCompositeSequenceableLoaderFactory}. + * loads data from multiple streams (video, audio etc.). * * @param compositeSequenceableLoaderFactory A factory to create composite {@link * SequenceableLoader}s for when this media source loads data from multiple streams (video, @@ -182,11 +181,13 @@ public final class SsMediaSource extends BaseMediaSource * @return This factory, for convenience. */ public Factory setCompositeSequenceableLoaderFactory( - @Nullable CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { + CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { this.compositeSequenceableLoaderFactory = - compositeSequenceableLoaderFactory != null - ? compositeSequenceableLoaderFactory - : new DefaultCompositeSequenceableLoaderFactory(); + checkNotNull( + compositeSequenceableLoaderFactory, + "SsMediaSource.Factory#setCompositeSequenceableLoaderFactory no longer handles null" + + " by instantiating a new DefaultCompositeSequenceableLoaderFactory. Explicitly" + + " construct and pass an instance in order to retain the old behavior."); return this; }