@Test public void getBitrates_useFormatBitrateAsLowerBoundSetTrue_returnsEstimateIfOnlyHigherThanFormat() { WindowedTrackBitrateEstimator estimator = new WindowedTrackBitrateEstimator( MAX_DURATION_MS, MAX_DURATION_MS, true); MediaChunk chunk = createMediaChunk( 5, 10); MediaChunkIterator iterator1 = createMediaChunkIteratorWithBitrate(80); MediaChunkIterator iterator2 = createMediaChunkIteratorWithBitrate(16); Format format1 = createFormatWithBitrate(10); Format format2 = createFormatWithBitrate(20); int[] bitrates = estimator.getBitrates( new Format[] {format1, format2}, Collections.singletonList(chunk), new MediaChunkIterator[] {iterator1, iterator2}, null); assertThat(bitrates).asList().containsExactly(80, 20).inOrder(); }
@Override public int[] getBitrates( Format[] formats, List<? extends MediaChunk> queue, MediaChunkIterator[] iterators, @Nullable int[] bitrates) { if (maxFutureDurationUs > 0 || maxPastDurationUs > 0) { return TrackSelectionUtil.getBitratesUsingPastAndFutureInfo( formats, queue, maxPastDurationUs, iterators, maxFutureDurationUs, useFormatBitrateAsLowerBound, bitrates); } return TrackSelectionUtil.getFormatBitrates(formats, bitrates); }
WindowedTrackBitrateEstimator implements TrackBitrateEstimator { @Override public int[] getBitrates( Format[] formats, List<? extends MediaChunk> queue, MediaChunkIterator[] iterators, @Nullable int[] bitrates) { if (maxFutureDurationUs > 0 || maxPastDurationUs > 0) { return TrackSelectionUtil.getBitratesUsingPastAndFutureInfo( formats, queue, maxPastDurationUs, iterators, maxFutureDurationUs, useFormatBitrateAsLowerBound, bitrates); } return TrackSelectionUtil.getFormatBitrates(formats, bitrates); } }
WindowedTrackBitrateEstimator implements TrackBitrateEstimator { @Override public int[] getBitrates( Format[] formats, List<? extends MediaChunk> queue, MediaChunkIterator[] iterators, @Nullable int[] bitrates) { if (maxFutureDurationUs > 0 || maxPastDurationUs > 0) { return TrackSelectionUtil.getBitratesUsingPastAndFutureInfo( formats, queue, maxPastDurationUs, iterators, maxFutureDurationUs, useFormatBitrateAsLowerBound, bitrates); } return TrackSelectionUtil.getFormatBitrates(formats, bitrates); } WindowedTrackBitrateEstimator(
      long maxPastDurationMs, long maxFutureDurationMs, boolean useFormatBitrateAsLowerBound); }
WindowedTrackBitrateEstimator implements TrackBitrateEstimator { @Override public int[] getBitrates( Format[] formats, List<? extends MediaChunk> queue, MediaChunkIterator[] iterators, @Nullable int[] bitrates) { if (maxFutureDurationUs > 0 || maxPastDurationUs > 0) { return TrackSelectionUtil.getBitratesUsingPastAndFutureInfo( formats, queue, maxPastDurationUs, iterators, maxFutureDurationUs, useFormatBitrateAsLowerBound, bitrates); } return TrackSelectionUtil.getFormatBitrates(formats, bitrates); } WindowedTrackBitrateEstimator(
      long maxPastDurationMs, long maxFutureDurationMs, boolean useFormatBitrateAsLowerBound); @Override int[] getBitrates(
      Format[] formats,
      List<? extends MediaChunk> queue,
      MediaChunkIterator[] iterators,
      @Nullable int[] bitrates); }
WindowedTrackBitrateEstimator implements TrackBitrateEstimator { @Override public int[] getBitrates( Format[] formats, List<? extends MediaChunk> queue, MediaChunkIterator[] iterators, @Nullable int[] bitrates) { if (maxFutureDurationUs > 0 || maxPastDurationUs > 0) { return TrackSelectionUtil.getBitratesUsingPastAndFutureInfo( formats, queue, maxPastDurationUs, iterators, maxFutureDurationUs, useFormatBitrateAsLowerBound, bitrates); } return TrackSelectionUtil.getFormatBitrates(formats, bitrates); } WindowedTrackBitrateEstimator(
      long maxPastDurationMs, long maxFutureDurationMs, boolean useFormatBitrateAsLowerBound); @Override int[] getBitrates(
      Format[] formats,
      List<? extends MediaChunk> queue,
      MediaChunkIterator[] iterators,
      @Nullable int[] bitrates);  }