Do not prepare MediaPeriods in a loop.

They may prepare immediately and let pendingMediaPeriods become empty before
all other periods are even created.

PiperOrigin-RevId: 232675283
This commit is contained in:
tonihei 2019-02-06 15:59:33 +00:00 committed by Andrew Lewis
parent a6c1dbe156
commit f898bddbfc

View File

@ -834,6 +834,8 @@ public final class DownloadHelper {
/* startPositionUs= */ 0); /* startPositionUs= */ 0);
mediaPeriods[i] = mediaPeriod; mediaPeriods[i] = mediaPeriod;
pendingMediaPeriods.add(mediaPeriod); pendingMediaPeriods.add(mediaPeriod);
}
for (MediaPeriod mediaPeriod : mediaPeriods) {
mediaPeriod.prepare(/* callback= */ this, /* positionUs= */ 0); mediaPeriod.prepare(/* callback= */ this, /* positionUs= */ 0);
} }
} }