Increase buffer duration (#7362)

When podcasts use dynamic ad insertion and the media file changes
between different network requests, users might experience jumps.
Now, try to basically download the whole episode as soon as one
hits the play button. That should avoid most of the jumps.
This commit is contained in:
ByteHamster 2024-08-30 18:11:26 +02:00 committed by GitHub
parent 279d37e8bb
commit 936bfa029e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,6 @@ import androidx.media3.ui.TrackNameProvider;
import de.danoeh.antennapod.net.common.UserAgentInterceptor;
import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;
import de.danoeh.antennapod.playback.service.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.net.common.HttpCredentialEncoder;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.model.playback.Playable;
@ -97,10 +96,10 @@ public class ExoPlayerWrapper {
private void createPlayer() {
DefaultLoadControl.Builder loadControl = new DefaultLoadControl.Builder();
loadControl.setBufferDurationsMs(30000, 120000,
loadControl.setBufferDurationsMs((int) TimeUnit.HOURS.toMillis(1), (int) TimeUnit.HOURS.toMillis(3),
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS,
DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);
loadControl.setBackBuffer(UserPreferences.getRewindSecs() * 1000 + 500, true);
loadControl.setBackBuffer((int) TimeUnit.MINUTES.toMillis(5), true);
trackSelector = new DefaultTrackSelector(context);
exoPlayer = new ExoPlayer.Builder(context, new DefaultRenderersFactory(context))
.setTrackSelector(trackSelector)
@ -154,7 +153,7 @@ public class ExoPlayerWrapper {
}
});
simpleCache = new SimpleCache(new File(context.getCacheDir(), "streaming"),
new LeastRecentlyUsedCacheEvictor(50 * 1024 * 1024), new StandaloneDatabaseProvider(context));
new LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024), new StandaloneDatabaseProvider(context));
initLoudnessEnhancer(exoPlayer.getAudioSessionId());
}