Commit 38ea53fc by andrewlewis Committed by Oliver Woodman

Revert discarding empty ad breaks

The previous change was too aggressive as it would clear future ad breaks.

Still clear the pending content position so the real content position is
reported after an empty ad break.

Issue: #4681
Issue: #4622

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209752306
parent bf43cca3
...@@ -631,11 +631,8 @@ public final class ImaAdsLoader ...@@ -631,11 +631,8 @@ public final class ImaAdsLoader
} else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) { } else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) {
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs; long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
contentPositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs; contentPositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
int adGroupIndexForPosition = expectedAdGroupIndex =
adPlaybackState.getAdGroupIndexForPositionUs(C.msToUs(contentPositionMs)); adPlaybackState.getAdGroupIndexForPositionUs(C.msToUs(contentPositionMs));
if (adGroupIndexForPosition != C.INDEX_UNSET) {
expectedAdGroupIndex = adGroupIndexForPosition;
}
} else if (imaAdState == IMA_AD_STATE_NONE && !playingAd && hasContentDuration) { } else if (imaAdState == IMA_AD_STATE_NONE && !playingAd && hasContentDuration) {
contentPositionMs = player.getCurrentPosition(); contentPositionMs = player.getCurrentPosition();
// Update the expected ad group index for the current content position. The update is delayed // Update the expected ad group index for the current content position. The update is delayed
...@@ -1127,15 +1124,6 @@ public final class ImaAdsLoader ...@@ -1127,15 +1124,6 @@ public final class ImaAdsLoader
if (pendingAdLoadError == null) { if (pendingAdLoadError == null) {
pendingAdLoadError = AdLoadException.createForAdGroup(error, adGroupIndex); pendingAdLoadError = AdLoadException.createForAdGroup(error, adGroupIndex);
} }
// Discard the ad break, which makes sure we don't receive duplicate load error events.
adsManager.discardAdBreak();
// Set the next expected ad group index so we can handle multiple load errors in a row.
adGroupIndex++;
if (adGroupIndex < adPlaybackState.adGroupCount) {
expectedAdGroupIndex = adGroupIndex;
} else {
expectedAdGroupIndex = C.INDEX_UNSET;
}
pendingContentPositionMs = C.TIME_UNSET; pendingContentPositionMs = C.TIME_UNSET;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment