Fix that loadingFinished is never set to true.

Previously loadingFinished will never be set to true because it started in
false, and we are and'ing it with `canceled`.

#minor-release

PiperOrigin-RevId: 370662456
This commit is contained in:
claincly 2021-04-27 14:02:27 +01:00 committed by bachinger
parent 65bb4eba25
commit bf04bb5bc0

View File

@ -353,6 +353,13 @@ public final class RtspMediaPeriod implements MediaPeriod {
}
}
private void updateLoadingFinished() {
loadingFinished = true;
for (int i = 0; i < rtspLoaderWrappers.size(); i++) {
loadingFinished &= rtspLoaderWrappers.get(i).canceled;
}
}
private static ImmutableList<TrackGroup> buildTrackGroups(
ImmutableList<RtspLoaderWrapper> rtspLoaderWrappers) {
ImmutableList.Builder<TrackGroup> listBuilder = new ImmutableList.Builder<>();
@ -583,9 +590,7 @@ public final class RtspMediaPeriod implements MediaPeriod {
canceled = true;
// Update loadingFinished every time loading is canceled.
for (int i = 0; i < rtspLoaderWrappers.size(); i++) {
loadingFinished &= rtspLoaderWrappers.get(i).canceled;
}
updateLoadingFinished();
}
/** Resets the {@link Loadable} and {@link SampleQueue} to prepare for an RTSP seek. */