From df41ae3f42ecc223d280587522c18cfa0390bc87 Mon Sep 17 00:00:00 2001 From: samrobinson Date: Mon, 20 Jan 2020 15:23:20 +0000 Subject: [PATCH] Add `FakeSampleStreamItem` to an existing FakeSampleStream. Allows items to be added to the queue once the sample stream has already been created. Means tests can simulate data not all being available at the start. PiperOrigin-RevId: 290613392 --- .../android/exoplayer2/testutil/FakeSampleStream.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeSampleStream.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeSampleStream.java index 203cfa902b..2eacf4da32 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeSampleStream.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeSampleStream.java @@ -133,6 +133,15 @@ public final class FakeSampleStream implements SampleStream { this.timeUs = timeUs; } + /** + * Adds an item to the end of the queue of {@link FakeSampleStreamItem items}. + * + * @param item The item to add. + */ + public void addFakeSampleStreamItem(FakeSampleStreamItem item) { + this.fakeSampleStreamItems.add(item); + } + @Override public boolean isReady() { return true;