Skip to content

Commit

Permalink
Revert discarding empty ad breaks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andrewlewis authored and ojw28 committed Aug 24, 2018
1 parent bf43cca commit 38ea53f
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,8 @@ public VideoProgressUpdate getContentProgress() {
} else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) {
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
contentPositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
int adGroupIndexForPosition =
expectedAdGroupIndex =
adPlaybackState.getAdGroupIndexForPositionUs(C.msToUs(contentPositionMs));
if (adGroupIndexForPosition != C.INDEX_UNSET) {
expectedAdGroupIndex = adGroupIndexForPosition;
}
} else if (imaAdState == IMA_AD_STATE_NONE && !playingAd && hasContentDuration) {
contentPositionMs = player.getCurrentPosition();
// Update the expected ad group index for the current content position. The update is delayed
Expand Down Expand Up @@ -1127,15 +1124,6 @@ private void handleAdGroupLoadError(Exception error) {
if (pendingAdLoadError == null) {
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;
}

Expand Down

0 comments on commit 38ea53f

Please sign in to comment.