mirror of
https://github.com/androidx/media.git
synced 2025-05-15 11:39:56 +08:00
remove keep alive check for updating primary url to avoid redundant playlist loading
This commit is contained in:
parent
ff2ece56dd
commit
cac16f1647
@ -112,11 +112,6 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
|
||||
* which an unchanging playlist is considered stuck.
|
||||
*/
|
||||
private static final double PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT = 3.5;
|
||||
/**
|
||||
* The minimum number of milliseconds that a url is kept as primary url, if no
|
||||
* {@link #getPlaylistSnapshot} call is made for that url.
|
||||
*/
|
||||
private static final long PRIMARY_URL_KEEPALIVE_MS = 15000;
|
||||
|
||||
private final Uri initialPlaylistUri;
|
||||
private final HlsDataSourceFactory dataSourceFactory;
|
||||
@ -205,7 +200,7 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
|
||||
*/
|
||||
public HlsMediaPlaylist getPlaylistSnapshot(HlsUrl url) {
|
||||
HlsMediaPlaylist snapshot = playlistBundles.get(url).getPlaylistSnapshot();
|
||||
if (snapshot != null) {
|
||||
if (url != primaryHlsUrl && snapshot != null ) {
|
||||
maybeSetPrimaryUrl(url);
|
||||
}
|
||||
return snapshot;
|
||||
@ -349,14 +344,10 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
|
||||
// the last primary snapshot contains an end tag.
|
||||
return;
|
||||
}
|
||||
MediaPlaylistBundle currentPrimaryBundle = playlistBundles.get(primaryHlsUrl);
|
||||
long primarySnapshotAccessAgeMs =
|
||||
SystemClock.elapsedRealtime() - currentPrimaryBundle.lastSnapshotAccessTimeMs;
|
||||
if (primarySnapshotAccessAgeMs > PRIMARY_URL_KEEPALIVE_MS) {
|
||||
|
||||
primaryHlsUrl = url;
|
||||
playlistBundles.get(primaryHlsUrl).loadPlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
private void createBundles(List<HlsUrl> urls) {
|
||||
int listSize = urls.size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user