mirror of
https://github.com/androidx/media.git
synced 2025-05-15 19:49:50 +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.
|
* which an unchanging playlist is considered stuck.
|
||||||
*/
|
*/
|
||||||
private static final double PLAYLIST_STUCK_TARGET_DURATION_COEFFICIENT = 3.5;
|
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 Uri initialPlaylistUri;
|
||||||
private final HlsDataSourceFactory dataSourceFactory;
|
private final HlsDataSourceFactory dataSourceFactory;
|
||||||
@ -205,7 +200,7 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
|
|||||||
*/
|
*/
|
||||||
public HlsMediaPlaylist getPlaylistSnapshot(HlsUrl url) {
|
public HlsMediaPlaylist getPlaylistSnapshot(HlsUrl url) {
|
||||||
HlsMediaPlaylist snapshot = playlistBundles.get(url).getPlaylistSnapshot();
|
HlsMediaPlaylist snapshot = playlistBundles.get(url).getPlaylistSnapshot();
|
||||||
if (snapshot != null) {
|
if (url != primaryHlsUrl && snapshot != null ) {
|
||||||
maybeSetPrimaryUrl(url);
|
maybeSetPrimaryUrl(url);
|
||||||
}
|
}
|
||||||
return snapshot;
|
return snapshot;
|
||||||
@ -349,14 +344,10 @@ public final class HlsPlaylistTracker implements Loader.Callback<ParsingLoadable
|
|||||||
// the last primary snapshot contains an end tag.
|
// the last primary snapshot contains an end tag.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MediaPlaylistBundle currentPrimaryBundle = playlistBundles.get(primaryHlsUrl);
|
|
||||||
long primarySnapshotAccessAgeMs =
|
|
||||||
SystemClock.elapsedRealtime() - currentPrimaryBundle.lastSnapshotAccessTimeMs;
|
|
||||||
if (primarySnapshotAccessAgeMs > PRIMARY_URL_KEEPALIVE_MS) {
|
|
||||||
primaryHlsUrl = url;
|
primaryHlsUrl = url;
|
||||||
playlistBundles.get(primaryHlsUrl).loadPlaylist();
|
playlistBundles.get(primaryHlsUrl).loadPlaylist();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void createBundles(List<HlsUrl> urls) {
|
private void createBundles(List<HlsUrl> urls) {
|
||||||
int listSize = urls.size();
|
int listSize = urls.size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user