Do not reset period uid when DashMediaSource is released

When the source is prepared again after stop, the period uid
is calculated by subtracting the `firstPeriodId` from the
period uid that is passed in to `createPeriod`. When this
happens after stop, the uid from the old period uid that
is still stored and has the value of the last played uid.

Hence the `firstPeriodId` must not be reset when released.

Issue: google/ExoPlayer#10838
PiperOrigin-RevId: 539028570
This commit is contained in:
bachinger 2023-06-09 10:01:53 +00:00 committed by Tofunmi Adigun-Hameed
parent b55ddf12b4
commit 319854d624
2 changed files with 4 additions and 2 deletions

View File

@ -87,6 +87,9 @@
* Cronet Extension: * Cronet Extension:
* RTMP Extension: * RTMP Extension:
* DASH Extension: * DASH Extension:
* Fix a bug where re-preparing a multi-period live Dash media source
produced a `IndexOutOfBoundsException`
([#10838](https://github.com/google/ExoPlayer/issues/10838)).
* HLS Extension: * HLS Extension:
* Smooth Streaming Extension: * Smooth Streaming Extension:
* RTSP Extension: * RTSP Extension:

View File

@ -525,7 +525,7 @@ public final class DashMediaSource extends BaseMediaSource {
DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(id); DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(id);
DashMediaPeriod mediaPeriod = DashMediaPeriod mediaPeriod =
new DashMediaPeriod( new DashMediaPeriod(
firstPeriodId + periodIndex, /* id= */ firstPeriodId + periodIndex,
manifest, manifest,
baseUrlExclusionList, baseUrlExclusionList,
periodIndex, periodIndex,
@ -573,7 +573,6 @@ public final class DashMediaSource extends BaseMediaSource {
elapsedRealtimeOffsetMs = C.TIME_UNSET; elapsedRealtimeOffsetMs = C.TIME_UNSET;
staleManifestReloadAttempt = 0; staleManifestReloadAttempt = 0;
expiredManifestPublishTimeUs = C.TIME_UNSET; expiredManifestPublishTimeUs = C.TIME_UNSET;
firstPeriodId = 0;
periodsById.clear(); periodsById.clear();
baseUrlExclusionList.reset(); baseUrlExclusionList.reset();
drmSessionManager.release(); drmSessionManager.release();