Skip to content

Commit bc945d8

Browse files
committed
refactor(sabr): remove unused constructors
1 parent a7d9b94 commit bc945d8

File tree

3 files changed

+4
-43
lines changed

3 files changed

+4
-43
lines changed

app/src/main/java/com/github/libretube/player/DefaultSabrChunkSource.kt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,10 @@ class DefaultSabrChunkSource(
4545
) : SabrChunkSource {
4646

4747
/** [SabrChunkSource.Factory] for [DefaultSabrChunkSource] instances. */
48-
class Factory
49-
/**
50-
* Creates a new instance.
51-
*
52-
* @param chunkExtractorFactory Creates [ChunkExtractor] instances to use for extracting
53-
* chunks.
54-
* @param dataSourceFactory Creates the [DataSource] to use for downloading chunks.
55-
*/(
56-
private val chunkExtractorFactory: ChunkExtractor.Factory,
48+
class Factory(
5749
private val dataSourceFactory: DataSource.Factory,
5850
) : SabrChunkSource.Factory {
59-
60-
/**
61-
* Equivalent to [new][.Factory].
62-
*/
63-
constructor(dataSourceFactory: DataSource.Factory) : this(
64-
BundledChunkExtractor.Factory(),
65-
dataSourceFactory,
66-
)
67-
51+
private val chunkExtractorFactory = BundledChunkExtractor.Factory()
6852

6953
override fun createSabrChunkSource(
7054
manifest: SabrManifest,

app/src/main/java/com/github/libretube/player/SabrMediaSource.kt

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,12 @@ class SabrMediaSource(
4343
}
4444

4545
/** Factory for [SabrMediaSource]s. */
46-
class Factory(
47-
private val chunkSourceFactory: SabrChunkSource.Factory,
48-
private val manifest: SabrManifest,
49-
) : MediaSource.Factory {
50-
46+
class Factory( private val manifest: SabrManifest) : MediaSource.Factory {
5147
private var cmcdConfigurationFactory: CmcdConfiguration.Factory? = null
5248
private var drmSessionManagerProvider: DrmSessionManagerProvider = DefaultDrmSessionManagerProvider()
5349
private val compositeSequenceableLoaderFactory= DefaultCompositeSequenceableLoaderFactory()
5450
private var loadErrorHandlingPolicy: LoadErrorHandlingPolicy = DefaultLoadErrorHandlingPolicy()
5551

56-
/**
57-
* Creates a new factory for [SabrMediaSource]s.
58-
*
59-
* The factory will use the following default components:
60-
* * [DefaultSabrChunkSource.Factory]
61-
* * [DefaultDrmSessionManagerProvider]
62-
* * [DefaultLoadErrorHandlingPolicy]
63-
* * [DefaultCompositeSequenceableLoaderFactory]
64-
*
65-
* @param dataSourceFactory A factory for [DataSource] instances that will be used to load
66-
* manifest and media data.
67-
*/
68-
constructor(dataSourceFactory: DataSource.Factory?, manifest: SabrManifest) : this(
69-
DefaultSabrChunkSource.Factory(dataSourceFactory!!),
70-
manifest
71-
)
72-
7352
override fun setCmcdConfigurationFactory(cmcdConfigurationFactory: CmcdConfiguration.Factory): Factory {
7453
this.cmcdConfigurationFactory =
7554
Assertions.checkNotNull<CmcdConfiguration.Factory?>(cmcdConfigurationFactory)
@@ -106,7 +85,7 @@ class SabrMediaSource(
10685
return SabrMediaSource(
10786
mediaItem,
10887
manifest,
109-
chunkSourceFactory,
88+
DefaultSabrChunkSource.Factory(SabrDataSource.Factory()),
11089
compositeSequenceableLoaderFactory,
11190
cmcdConfiguration,
11291
drmSessionManagerProvider.get(mediaItem),

app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import com.github.libretube.helpers.PreferenceHelper
3737
import com.github.libretube.helpers.ProxyHelper
3838
import com.github.libretube.parcelable.PlayerData
3939
import com.github.libretube.util.DeArrowUtil
40-
import com.github.libretube.player.SABRDataSource
4140
import com.github.libretube.player.SabrMediaSource
4241
import com.github.libretube.player.manifest.SabrManifest
4342
import com.github.libretube.util.PlayingQueue
@@ -274,7 +273,6 @@ open class OnlinePlayerService : AbstractPlayerService() {
274273
// only enable when in DEBUG, as the implementation is still experimental
275274
BuildConfig.DEBUG && streams.serverAbrStreamingUrl != null && streams.videoPlaybackUstreamerConfig != null -> {
276275
val sabrMediaSourceFactory = SabrMediaSource.Factory(
277-
SABRDataSource.Factory(),
278276
SabrManifest(videoId, streams)
279277
)
280278
val mediaItem = createMediaItem(

0 commit comments

Comments
 (0)