Commit 2c10e6f1 by olly Committed by Oliver Woodman

We're not playing an ad if the timeline is empty.

Issue: #3334

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172447125
parent f6821c6d
...@@ -386,17 +386,17 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -386,17 +386,17 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Override @Override
public boolean isPlayingAd() { public boolean isPlayingAd() {
return pendingSeekAcks == 0 && playbackInfo.periodId.isAd(); return !timeline.isEmpty() && pendingSeekAcks == 0 && playbackInfo.periodId.isAd();
} }
@Override @Override
public int getCurrentAdGroupIndex() { public int getCurrentAdGroupIndex() {
return pendingSeekAcks == 0 ? playbackInfo.periodId.adGroupIndex : C.INDEX_UNSET; return isPlayingAd() ? playbackInfo.periodId.adGroupIndex : C.INDEX_UNSET;
} }
@Override @Override
public int getCurrentAdIndexInAdGroup() { public int getCurrentAdIndexInAdGroup() {
return pendingSeekAcks == 0 ? playbackInfo.periodId.adIndexInAdGroup : C.INDEX_UNSET; return isPlayingAd() ? playbackInfo.periodId.adIndexInAdGroup : C.INDEX_UNSET;
} }
@Override @Override
......
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