mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Use final reference to content timeline inside handler message
The content timeline field may be updated when the live timeline is refreshed in the looper event preceding the runnable that is posted to the player thread. Hence a new timeline may contain a new period uid that is not present in the ad playback state map. Using a final reference makes sure period and ad playback state match when asserted. PiperOrigin-RevId: 518228165
This commit is contained in:
parent
0a2a20d4fb
commit
0bae410f7d
1 changed files with 3 additions and 2 deletions
|
|
@ -188,6 +188,7 @@ public final class ServerSideAdInsertionMediaSource extends BaseMediaSource
|
|||
if (playbackHandler == null) {
|
||||
this.adPlaybackStates = adPlaybackStates;
|
||||
} else {
|
||||
Timeline finalContentTimeline = contentTimeline;
|
||||
playbackHandler.post(
|
||||
() -> {
|
||||
for (SharedMediaPeriod mediaPeriod : mediaPeriods.values()) {
|
||||
|
|
@ -206,9 +207,9 @@ public final class ServerSideAdInsertionMediaSource extends BaseMediaSource
|
|||
}
|
||||
}
|
||||
this.adPlaybackStates = adPlaybackStates;
|
||||
if (contentTimeline != null) {
|
||||
if (finalContentTimeline != null) {
|
||||
refreshSourceInfo(
|
||||
new ServerSideAdInsertionTimeline(contentTimeline, adPlaybackStates));
|
||||
new ServerSideAdInsertionTimeline(finalContentTimeline, adPlaybackStates));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue