mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-20 16:50:58 +02:00
Makes max exoplayer pool size to a variable in the class
This commit is contained in:
@@ -37,9 +37,9 @@ import java.util.concurrent.ConcurrentLinkedQueue
|
||||
@OptIn(UnstableApi::class)
|
||||
class ExoPlayerPool(
|
||||
val builder: ExoPlayerBuilder,
|
||||
private val poolSize: Int,
|
||||
) {
|
||||
private val playerPool = ConcurrentLinkedQueue<ExoPlayer>()
|
||||
private val poolSize = SimultaneousPlaybackCalculator.max()
|
||||
private val poolStartingSize = 3
|
||||
|
||||
// Exists to avoid exceptions stopping the coroutine
|
||||
|
@@ -33,6 +33,7 @@ import com.vitorpamplona.amethyst.service.playback.pip.BackgroundMedia
|
||||
import com.vitorpamplona.amethyst.service.playback.playerPool.ExoPlayerBuilder
|
||||
import com.vitorpamplona.amethyst.service.playback.playerPool.ExoPlayerPool
|
||||
import com.vitorpamplona.amethyst.service.playback.playerPool.MediaSessionPool
|
||||
import com.vitorpamplona.amethyst.service.playback.playerPool.SimultaneousPlaybackCalculator
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class PlaybackService : MediaSessionService() {
|
||||
@@ -42,7 +43,11 @@ class PlaybackService : MediaSessionService() {
|
||||
@OptIn(UnstableApi::class)
|
||||
fun newPool(okHttp: OkHttpClient): MediaSessionPool =
|
||||
MediaSessionPool(
|
||||
ExoPlayerPool(ExoPlayerBuilder(okHttp)),
|
||||
exoPlayerPool =
|
||||
ExoPlayerPool(
|
||||
ExoPlayerBuilder(okHttp),
|
||||
poolSize = SimultaneousPlaybackCalculator.max(applicationContext),
|
||||
),
|
||||
okHttpClient = okHttp,
|
||||
reset = { session, keepPlaying ->
|
||||
(session.player as ExoPlayer).apply {
|
||||
|
Reference in New Issue
Block a user