mirror of
https://github.com/androidx/media.git
synced 2025-04-29 22:36:54 +08:00
Don't enqueue ad periods that start after the end of the period
Issue: androidx/media#2215 PiperOrigin-RevId: 747376615
This commit is contained in:
parent
3205811f23
commit
ed56ed22fb
@ -2981,6 +2981,10 @@ This release corresponds to the
|
||||
* Ad playback / IMA:
|
||||
* Decrease ad polling rate from every 100ms to every 200ms, to line up
|
||||
with Media Rating Council (MRC) recommendations.
|
||||
* Fix bug where ad groups after the end of a VOD window stalled playback.
|
||||
Ads groups with a start time after the window are not enqueued into the
|
||||
`MediaPeriodQueue` anymore
|
||||
([#2215](https://github.com/androidx/media/issues/2215)).
|
||||
* FFmpeg extension:
|
||||
* Update CMake version to `3.21.0+` to avoid a CMake bug causing
|
||||
AndroidStudio's gradle sync to fail
|
||||
|
@ -865,7 +865,10 @@ public final class AdPlaybackState {
|
||||
|| !getAdGroup(index).shouldPlayAdGroup())) {
|
||||
index++;
|
||||
}
|
||||
return index < adGroupCount ? index : C.INDEX_UNSET;
|
||||
return index < adGroupCount
|
||||
&& (periodDurationUs == C.TIME_UNSET || getAdGroup(index).timeUs <= periodDurationUs)
|
||||
? index
|
||||
: C.INDEX_UNSET;
|
||||
}
|
||||
|
||||
/** Returns whether the specified ad has been marked as in {@link #AD_STATE_ERROR}. */
|
||||
|
@ -856,6 +856,10 @@ public class AdPlaybackStateTest {
|
||||
state.getAdGroupIndexAfterPositionUs(
|
||||
/* positionUs= */ C.TIME_END_OF_SOURCE, /* periodDurationUs= */ 5000))
|
||||
.isEqualTo(C.INDEX_UNSET);
|
||||
assertThat(
|
||||
state.getAdGroupIndexAfterPositionUs(
|
||||
/* positionUs= */ 1001, /* periodDurationUs= */ 1002))
|
||||
.isEqualTo(C.INDEX_UNSET);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -868,7 +868,7 @@ import java.util.Objects;
|
||||
}
|
||||
|
||||
if (imaAdState == IMA_AD_STATE_NONE
|
||||
&& playbackState == Player.STATE_BUFFERING
|
||||
&& (playbackState == Player.STATE_BUFFERING || playbackState == Player.STATE_ENDED)
|
||||
&& playWhenReady) {
|
||||
ensureSentContentCompleteIfAtEndOfStream();
|
||||
} else if (imaAdState != IMA_AD_STATE_NONE && playbackState == Player.STATE_ENDED) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user