From c28a2a4100e098ec2e68101e230d1b5d599e2ff0 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Tue, 18 Jul 2017 00:57:53 -0700 Subject: [PATCH] Fix content position for postroll ads The position returned by getContentPosition() could be C.TIME_END_OF_SOURCE. Fix the content position stored in MediaPeriodInfos for postroll ads to be the duration of the containing period. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162322339 --- .../com/google/android/exoplayer2/MediaPeriodInfoSequence.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodInfoSequence.java b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodInfoSequence.java index ca4696e34a..d8c82dd498 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodInfoSequence.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodInfoSequence.java @@ -223,8 +223,9 @@ import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId; || !period.isAdAvailable(adGroupCount - 1, 0)) { return null; } + long contentDurationUs = period.getDurationUs(); return getMediaPeriodInfoForAd(currentPeriodId.periodIndex, adGroupCount - 1, 0, - currentMediaPeriodInfo.endPositionUs); + contentDurationUs); } }