SampleQueue implements TrackOutput { public final synchronized int advanceToEnd() { int skipCount = length - readPosition; readPosition = length; return skipCount; } SampleQueue(Allocator allocator, DrmSessionManager<?> drmSessionManager); @CallSuper void release(); final void reset(); @CallSuper void reset(boolean resetUpstreamFormat); final void sourceId(int sourceId); final void splice(); final int getWriteIndex(); final void discardUpstreamSamples(int discardFromIndex); @CallSuper void preRelease(); @CallSuper void maybeThrowError(); final int getFirstIndex(); final int getReadIndex(); final synchronized int peekSourceId(); final synchronized Format getUpstreamFormat(); final synchronized long getLargestQueuedTimestampUs(); final synchronized boolean isLastSampleQueued(); final synchronized long getFirstTimestampUs(); @SuppressWarnings("ReferenceEquality") // See comments in setUpstreamFormat @CallSuper synchronized boolean isReady(boolean loadingFinished); @CallSuper int read(
      FormatHolder formatHolder,
      DecoderInputBuffer buffer,
      boolean formatRequired,
      boolean loadingFinished,
      long decodeOnlyUntilUs); final synchronized boolean seekTo(int sampleIndex); final synchronized boolean seekTo(long timeUs, boolean allowTimeBeyondBuffer); final synchronized int advanceTo(long timeUs); final synchronized int advanceToEnd(); final void discardTo(long timeUs, boolean toKeyframe, boolean stopAtReadPosition); final void discardToRead(); final void discardToEnd(); final void setSampleOffsetUs(long sampleOffsetUs); final void setUpstreamFormatChangeListener(UpstreamFormatChangedListener listener); @Override final void format(Format unadjustedUpstreamFormat); @Override final int sampleData(ExtractorInput input, int length, boolean allowEndOfInput); @Override final void sampleData(ParsableByteArray buffer, int length); @Override final void sampleMetadata(
      long timeUs,
      @C.BufferFlags int flags,
      int size,
      int offset,
      @Nullable CryptoData cryptoData); synchronized long discardSampleMetadataToRead();  }
@Test public void testAdvanceToEnd() { writeTestData(); sampleQueue.advanceToEnd(); assertAllocationCount(10); sampleQueue.discardToRead(); assertAllocationCount(0); assertReadFormat(false, FORMAT_2); assertNoSamplesToRead(FORMAT_2); }