Commit 72437e44 by bachinger Committed by Ian Baker

Rollback of https://github.com/google/ExoPlayer/commit/ff89170b008b8b3438b7c002a156fbfb41c05174

*** Original commit ***

Fix some logic in AnalyticsCollector.

All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
try to use the media period data from the playing media period as set in the
playback thread queue. This is only correct as long as there no pending masking
operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
is empty or a seek is pending. Since adding all the playlist API methods to the player,
this is no longer the right choice. Moreover,...

***

PiperOrigin-RevId: 290312118
parent 4cf614c6
......@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Looper;
import android.view.Surface;
import androidx.annotation.Nullable;
......@@ -2968,7 +2969,10 @@ public final class ExoPlayerTest {
@Test
public void contentWithInitialSeekPositionAfterPrerollAdStartsAtSeekPosition() throws Exception {
AdPlaybackState adPlaybackState =
FakeTimeline.createAdPlaybackState(/* adsPerAdGroup= */ 3, /* adGroupTimesUs...= */ 0);
FakeTimeline.createAdPlaybackState(/* adsPerAdGroup= */ 3, /* adGroupTimesUs= */ 0)
.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, Uri.parse("https://ad1"))
.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 1, Uri.parse("https://ad2"))
.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, Uri.parse("https://ad3"));
Timeline fakeTimeline =
new FakeTimeline(
new TimelineWindowDefinition(
......@@ -4056,14 +4060,15 @@ public final class ExoPlayerTest {
}
})
.build();
new ExoPlayerTestRunner.Builder()
.setMediaSources(concatenatingMediaSource)
.initialSeek(seekToWindowIndex, 5000)
.setActionSchedule(actionSchedule)
.build(context)
.start()
.blockUntilActionScheduleFinished(TIMEOUT_MS)
.blockUntilEnded(TIMEOUT_MS);
ExoPlayerTestRunner testRunner =
new ExoPlayerTestRunner.Builder()
.setMediaSources(concatenatingMediaSource)
.initialSeek(seekToWindowIndex, 5000)
.setActionSchedule(actionSchedule)
.build(context)
.start()
.blockUntilActionScheduleFinished(TIMEOUT_MS)
.blockUntilEnded(TIMEOUT_MS);
assertArrayEquals(new long[] {5_000}, currentPlaybackPositions);
assertArrayEquals(new int[] {seekToWindowIndex}, currentWindowIndices);
}
......
......@@ -15,7 +15,6 @@
*/
package com.google.android.exoplayer2.testutil;
import android.net.Uri;
import android.util.Pair;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Timeline;
......@@ -161,19 +160,11 @@ public final class FakeTimeline extends Timeline {
AdPlaybackState adPlaybackState = new AdPlaybackState(adGroupTimesUs);
long[][] adDurationsUs = new long[adGroupCount][];
for (int i = 0; i < adGroupCount; i++) {
adPlaybackState = adPlaybackState.withAdCount(/* adGroupIndex= */ i, adsPerAdGroup);
for (int j = 0; j < adsPerAdGroup; j++) {
adPlaybackState =
adPlaybackState.withAdUri(
/* adGroupIndex= */ i,
/* adIndexInAdGroup= */ j,
Uri.parse("https://ad/" + i + "/" + j));
}
adPlaybackState = adPlaybackState.withAdCount(i, adsPerAdGroup);
adDurationsUs[i] = new long[adsPerAdGroup];
Arrays.fill(adDurationsUs[i], AD_DURATION_US);
}
adPlaybackState = adPlaybackState.withAdDurationsUs(adDurationsUs);
return adPlaybackState;
}
......
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