mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Exit early progressive loads if the load task is canceled
Add an check when loading progressive media in case the load is canceled. If the player is released very early, the progressive media period may carry on with the initial loading unnecessarily. PiperOrigin-RevId: 586288385 (cherry picked from commit 3d1d8f4439f194029d1522137b7f428e96bf61b3)
This commit is contained in:
parent
d68c36e082
commit
3f3287aba3
@ -1027,6 +1027,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
long position = positionHolder.position;
|
||||
dataSpec = buildDataSpec(position);
|
||||
long length = dataSource.open(dataSpec);
|
||||
if (loadCanceled) {
|
||||
break;
|
||||
}
|
||||
if (length != C.LENGTH_UNSET) {
|
||||
length += position;
|
||||
onLengthKnown();
|
||||
|
Loading…
x
Reference in New Issue
Block a user