Skip to content

Commit

Permalink
Exit early progressive loads if the load task is canceled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
christosts authored and copybara-github committed Nov 29, 2023
1 parent 3204313 commit 3d1d8f4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,9 @@ public void load() throws IOException {
long position = positionHolder.position;
dataSpec = buildDataSpec(position);
long length = dataSource.open(dataSpec);
if (loadCanceled) {
break;
}
if (length != C.LENGTH_UNSET) {
length += position;
onLengthKnown();
Expand Down

0 comments on commit 3d1d8f4

Please sign in to comment.