com.google.android.exoplayer2.source.chunk.MediaChunk Java Examples
The following examples show how to use
com.google.android.exoplayer2.source.chunk.MediaChunk.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackSelectionUtil.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Returns bitrate values for a set of tracks whose formats are given, using the given upcoming * media chunk iterators and the queue of already buffered {@link MediaChunk}s. * * @param formats The track formats. * @param queue The queue of already buffered {@link MediaChunk}s. Must not be modified. * @param maxPastDurationUs Maximum duration of past chunks to be included in average bitrate * values, in microseconds. * @param iterators An array of {@link MediaChunkIterator}s providing information about the * sequence of upcoming media chunks for each track. * @param maxFutureDurationUs Maximum duration of future chunks to be included in average bitrate * values, in microseconds. * @param useFormatBitrateAsLowerBound Whether to return the estimated bitrate only if it's higher * than the bitrate of the track's format. * @param bitrates An array into which the bitrate values will be written. If non-null, this array * is the one that will be returned. * @return Bitrate values for the tracks. As long as the format of a track has set bitrate, a * bitrate value is set in the returned array. Otherwise it might be set to {@link * Format#NO_VALUE}. */ public static int[] getBitratesUsingPastAndFutureInfo( Format[] formats, List<? extends MediaChunk> queue, long maxPastDurationUs, MediaChunkIterator[] iterators, long maxFutureDurationUs, boolean useFormatBitrateAsLowerBound, @Nullable int[] bitrates) { bitrates = getBitratesUsingFutureInfo(iterators, formats, maxFutureDurationUs, bitrates); getBitratesUsingPastInfo(queue, formats, maxPastDurationUs, bitrates); for (int i = 0; i < bitrates.length; i++) { int bitrate = bitrates[i]; if (bitrate == Format.NO_VALUE || (useFormatBitrateAsLowerBound && formats[i].bitrate != Format.NO_VALUE && bitrate < formats[i].bitrate)) { bitrates[i] = formats[i].bitrate; } } return bitrates; }
Example #2
Source File: TrackSelectionUtil.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Returns bitrate values for a set of tracks whose formats are given, using the given queue of * already buffered {@link MediaChunk} instances. * * @param queue The queue of already buffered {@link MediaChunk} instances. Must not be modified. * @param formats The track formats. * @param maxDurationUs Maximum duration of chunks to be included in average bitrate values, in * microseconds. * @param bitrates If not null, calculates bitrate values only for indexes set to Format.NO_VALUE * and stores result in this array. * @return Bitrate values for the tracks. If for a track, a bitrate value can't be calculated, * {@link Format#NO_VALUE} is set. * @see #getBitratesUsingFutureInfo(MediaChunkIterator[], Format[], long, int[]) */ @VisibleForTesting /* package */ static int[] getBitratesUsingPastInfo( List<? extends MediaChunk> queue, Format[] formats, long maxDurationUs, @Nullable int[] bitrates) { if (bitrates == null) { bitrates = new int[formats.length]; Arrays.fill(bitrates, Format.NO_VALUE); } if (maxDurationUs == 0) { return bitrates; } int queueAverageBitrate = getAverageQueueBitrate(queue, maxDurationUs); if (queueAverageBitrate == Format.NO_VALUE) { return bitrates; } int queueFormatBitrate = queue.get(queue.size() - 1).trackFormat.bitrate; if (queueFormatBitrate != Format.NO_VALUE) { float queueBitrateRatio = ((float) queueAverageBitrate) / queueFormatBitrate; estimateBitrates( bitrates, formats, new int[] {queueFormatBitrate}, new float[] {queueBitrateRatio}); } return bitrates; }
Example #3
Source File: HlsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { long nowMs = SystemClock.elapsedRealtime(); if (!isBlacklisted(selectedIndex, nowMs)) { return; } // Try from lowest bitrate to highest. for (int i = length - 1; i >= 0; i--) { if (!isBlacklisted(i, nowMs)) { selectedIndex = i; return; } } // Should never happen. throw new IllegalStateException(); }
Example #4
Source File: WindowedTrackBitrateEstimator.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@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); }
Example #5
Source File: WindowedTrackBitrateEstimator.java From Telegram with GNU General Public License v2.0 | 6 votes |
@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); }
Example #6
Source File: HlsChunkSource.java From MediaSDK with Apache License 2.0 | 6 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { long nowMs = SystemClock.elapsedRealtime(); if (!isBlacklisted(selectedIndex, nowMs)) { return; } // Try from lowest bitrate to highest. for (int i = length - 1; i >= 0; i--) { if (!isBlacklisted(i, nowMs)) { selectedIndex = i; return; } } // Should never happen. throw new IllegalStateException(); }
Example #7
Source File: DefaultDashChunkSource.java From K-Sonic with MIT License | 6 votes |
@Override public boolean onChunkLoadError(Chunk chunk, boolean cancelable, Exception e) { if (!cancelable) { return false; } // Workaround for missing segment at the end of the period if (!manifest.dynamic && chunk instanceof MediaChunk && e instanceof InvalidResponseCodeException && ((InvalidResponseCodeException) e).responseCode == 404) { RepresentationHolder representationHolder = representationHolders[trackSelection.indexOf(chunk.trackFormat)]; int segmentCount = representationHolder.getSegmentCount(); if (segmentCount != DashSegmentIndex.INDEX_UNBOUNDED && segmentCount != 0) { int lastAvailableSegmentNum = representationHolder.getFirstSegmentNum() + segmentCount - 1; if (((MediaChunk) chunk).getNextChunkIndex() > lastAvailableSegmentNum) { missingLastSegment = true; return true; } } } // Blacklist if appropriate. return ChunkedTrackBlacklistUtil.maybeBlacklistTrack(trackSelection, trackSelection.indexOf(chunk.trackFormat), e); }
Example #8
Source File: HlsChunkSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { long nowMs = SystemClock.elapsedRealtime(); if (!isBlacklisted(selectedIndex, nowMs)) { return; } // Try from lowest bitrate to highest. for (int i = length - 1; i >= 0; i--) { if (!isBlacklisted(i, nowMs)) { selectedIndex = i; return; } } // Should never happen. throw new IllegalStateException(); }
Example #9
Source File: TrackSelectionUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Returns bitrate values for a set of tracks whose formats are given, using the given upcoming * media chunk iterators and the queue of already buffered {@link MediaChunk}s. * * @param formats The track formats. * @param queue The queue of already buffered {@link MediaChunk}s. Must not be modified. * @param maxPastDurationUs Maximum duration of past chunks to be included in average bitrate * values, in microseconds. * @param iterators An array of {@link MediaChunkIterator}s providing information about the * sequence of upcoming media chunks for each track. * @param maxFutureDurationUs Maximum duration of future chunks to be included in average bitrate * values, in microseconds. * @param useFormatBitrateAsLowerBound Whether to return the estimated bitrate only if it's higher * than the bitrate of the track's format. * @param bitrates An array into which the bitrate values will be written. If non-null, this array * is the one that will be returned. * @return Bitrate values for the tracks. As long as the format of a track has set bitrate, a * bitrate value is set in the returned array. Otherwise it might be set to {@link * Format#NO_VALUE}. */ public static int[] getBitratesUsingPastAndFutureInfo( Format[] formats, List<? extends MediaChunk> queue, long maxPastDurationUs, MediaChunkIterator[] iterators, long maxFutureDurationUs, boolean useFormatBitrateAsLowerBound, @Nullable int[] bitrates) { bitrates = getBitratesUsingFutureInfo(iterators, formats, maxFutureDurationUs, bitrates); getBitratesUsingPastInfo(queue, formats, maxPastDurationUs, bitrates); for (int i = 0; i < bitrates.length; i++) { int bitrate = bitrates[i]; if (bitrate == Format.NO_VALUE || (useFormatBitrateAsLowerBound && formats[i].bitrate != Format.NO_VALUE && bitrate < formats[i].bitrate)) { bitrates[i] = formats[i].bitrate; } } return bitrates; }
Example #10
Source File: TrackSelectionUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Returns bitrate values for a set of tracks whose formats are given, using the given queue of * already buffered {@link MediaChunk} instances. * * @param queue The queue of already buffered {@link MediaChunk} instances. Must not be modified. * @param formats The track formats. * @param maxDurationUs Maximum duration of chunks to be included in average bitrate values, in * microseconds. * @param bitrates If not null, calculates bitrate values only for indexes set to Format.NO_VALUE * and stores result in this array. * @return Bitrate values for the tracks. If for a track, a bitrate value can't be calculated, * {@link Format#NO_VALUE} is set. * @see #getBitratesUsingFutureInfo(MediaChunkIterator[], Format[], long, int[]) */ @VisibleForTesting /* package */ static int[] getBitratesUsingPastInfo( List<? extends MediaChunk> queue, Format[] formats, long maxDurationUs, @Nullable int[] bitrates) { if (bitrates == null) { bitrates = new int[formats.length]; Arrays.fill(bitrates, Format.NO_VALUE); } if (maxDurationUs == 0) { return bitrates; } int queueAverageBitrate = getAverageQueueBitrate(queue, maxDurationUs); if (queueAverageBitrate == Format.NO_VALUE) { return bitrates; } int queueFormatBitrate = queue.get(queue.size() - 1).trackFormat.bitrate; if (queueFormatBitrate != Format.NO_VALUE) { float queueBitrateRatio = ((float) queueAverageBitrate) / queueFormatBitrate; estimateBitrates( bitrates, formats, new int[] {queueFormatBitrate}, new float[] {queueBitrateRatio}); } return bitrates; }
Example #11
Source File: FixedTrackSelection.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { // Do nothing. }
Example #12
Source File: DefaultSsChunkSource.java From MediaSDK with Apache License 2.0 | 5 votes |
private static MediaChunk newMediaChunk( Format format, DataSource dataSource, Uri uri, String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs, long chunkSeekTimeUs, int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) { DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey); // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk. // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs. long sampleOffsetUs = chunkStartTimeUs; return new ContainerMediaChunk( dataSource, dataSpec, format, trackSelectionReason, trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkSeekTimeUs, /* clippedEndTimeUs= */ C.TIME_UNSET, chunkIndex, /* chunkCount= */ 1, sampleOffsetUs, extractorWrapper); }
Example #13
Source File: FixedTrackSelection.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { // Do nothing. }
Example #14
Source File: BufferSizeAdaptationBuilder.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { updateFormatBitrates(/* nowMs= */ clock.elapsedRealtime()); // Make initial selection if (selectionReason == C.SELECTION_REASON_UNKNOWN) { selectionReason = C.SELECTION_REASON_INITIAL; selectedIndex = selectIdealIndexUsingBandwidth(/* isInitialSelection= */ true); return; } long bufferUs = getCurrentPeriodBufferedDurationUs(playbackPositionUs, bufferedDurationUs); int oldSelectedIndex = selectedIndex; if (isInSteadyState) { selectIndexSteadyState(bufferUs); } else { selectIndexStartUpPhase(bufferUs); } if (selectedIndex != oldSelectedIndex) { selectionReason = C.SELECTION_REASON_ADAPTIVE; } }
Example #15
Source File: DefaultSsChunkSource.java From K-Sonic with MIT License | 5 votes |
private static MediaChunk newMediaChunk(Format format, DataSource dataSource, Uri uri, String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs, int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) { DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey); // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk. // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs. long sampleOffsetUs = chunkStartTimeUs; return new ContainerMediaChunk(dataSource, dataSpec, format, trackSelectionReason, trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkIndex, 1, sampleOffsetUs, extractorWrapper); }
Example #16
Source File: DefaultSsChunkSource.java From K-Sonic with MIT License | 5 votes |
@Override public int getPreferredQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (fatalError != null || trackSelection.length() < 2) { return queue.size(); } return trackSelection.evaluateQueueSize(playbackPositionUs, queue); }
Example #17
Source File: DefaultDashChunkSource.java From K-Sonic with MIT License | 5 votes |
@Override public int getPreferredQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (fatalError != null || trackSelection.length() < 2) { return queue.size(); } return trackSelection.evaluateQueueSize(playbackPositionUs, queue); }
Example #18
Source File: AdaptiveTrackSelection.java From K-Sonic with MIT License | 5 votes |
@Override public int evaluateQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (queue.isEmpty()) { return 0; } int queueSize = queue.size(); long bufferedDurationUs = queue.get(queueSize - 1).endTimeUs - playbackPositionUs; if (bufferedDurationUs < minDurationToRetainAfterDiscardUs) { return queueSize; } int idealSelectedIndex = determineIdealSelectedIndex(SystemClock.elapsedRealtime()); Format idealFormat = getFormat(idealSelectedIndex); // If the chunks contain video, discard from the first SD chunk beyond // minDurationToRetainAfterDiscardUs whose resolution and bitrate are both lower than the ideal // track. for (int i = 0; i < queueSize; i++) { MediaChunk chunk = queue.get(i); Format format = chunk.trackFormat; long durationBeforeThisChunkUs = chunk.startTimeUs - playbackPositionUs; if (durationBeforeThisChunkUs >= minDurationToRetainAfterDiscardUs && format.bitrate < idealFormat.bitrate && format.height != Format.NO_VALUE && format.height < 720 && format.width != Format.NO_VALUE && format.width < 1280 && format.height < idealFormat.height) { return i; } } return queueSize; }
Example #19
Source File: DefaultSsChunkSource.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public int getPreferredQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (fatalError != null || trackSelection.length() < 2) { return queue.size(); } return trackSelection.evaluateQueueSize(playbackPositionUs, queue); }
Example #20
Source File: RandomTrackSelection.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { // Count the number of non-blacklisted formats. long nowMs = SystemClock.elapsedRealtime(); int nonBlacklistedFormatCount = 0; for (int i = 0; i < length; i++) { if (!isBlacklisted(i, nowMs)) { nonBlacklistedFormatCount++; } } selectedIndex = random.nextInt(nonBlacklistedFormatCount); if (nonBlacklistedFormatCount != length) { // Adjust the format index to account for blacklisted formats. nonBlacklistedFormatCount = 0; for (int i = 0; i < length; i++) { if (!isBlacklisted(i, nowMs) && selectedIndex == nonBlacklistedFormatCount++) { selectedIndex = i; return; } } } }
Example #21
Source File: BufferSizeAdaptationBuilder.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { updateFormatBitrates(/* nowMs= */ clock.elapsedRealtime()); // Make initial selection if (selectionReason == C.SELECTION_REASON_UNKNOWN) { selectionReason = C.SELECTION_REASON_INITIAL; selectedIndex = selectIdealIndexUsingBandwidth(/* isInitialSelection= */ true); return; } long bufferUs = getCurrentPeriodBufferedDurationUs(playbackPositionUs, bufferedDurationUs); int oldSelectedIndex = selectedIndex; if (isInSteadyState) { selectIndexSteadyState(bufferUs); } else { selectIndexStartUpPhase(bufferUs); } if (selectedIndex != oldSelectedIndex) { selectionReason = C.SELECTION_REASON_ADAPTIVE; } }
Example #22
Source File: RandomTrackSelection.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { // Count the number of non-blacklisted formats. long nowMs = SystemClock.elapsedRealtime(); int nonBlacklistedFormatCount = 0; for (int i = 0; i < length; i++) { if (!isBlacklisted(i, nowMs)) { nonBlacklistedFormatCount++; } } selectedIndex = random.nextInt(nonBlacklistedFormatCount); if (nonBlacklistedFormatCount != length) { // Adjust the format index to account for blacklisted formats. nonBlacklistedFormatCount = 0; for (int i = 0; i < length; i++) { if (!isBlacklisted(i, nowMs) && selectedIndex == nonBlacklistedFormatCount++) { selectedIndex = i; return; } } } }
Example #23
Source File: TrackSelectionUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static int getAverageQueueBitrate(List<? extends MediaChunk> queue, long maxDurationUs) { if (queue.isEmpty()) { return Format.NO_VALUE; } MediaChunkListIterator iterator = new MediaChunkListIterator(getSingleFormatSubQueue(queue), /* reverseOrder= */ true); return getAverageBitrate(iterator, maxDurationUs); }
Example #24
Source File: TrackSelectionUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static List<? extends MediaChunk> getSingleFormatSubQueue( List<? extends MediaChunk> queue) { Format queueFormat = queue.get(queue.size() - 1).trackFormat; int queueSize = queue.size(); for (int i = queueSize - 2; i >= 0; i--) { if (!queue.get(i).trackFormat.equals(queueFormat)) { return queue.subList(i + 1, queueSize); } } return queue; }
Example #25
Source File: FixedTrackSelection.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void updateSelectedTrack( long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators) { // Do nothing. }
Example #26
Source File: DefaultSsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static MediaChunk newMediaChunk( Format format, DataSource dataSource, Uri uri, String cacheKey, int chunkIndex, long chunkStartTimeUs, long chunkEndTimeUs, long chunkSeekTimeUs, int trackSelectionReason, Object trackSelectionData, ChunkExtractorWrapper extractorWrapper) { DataSpec dataSpec = new DataSpec(uri, 0, C.LENGTH_UNSET, cacheKey); // In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk. // To convert them the absolute timestamps, we need to set sampleOffsetUs to chunkStartTimeUs. long sampleOffsetUs = chunkStartTimeUs; return new ContainerMediaChunk( dataSource, dataSpec, format, trackSelectionReason, trackSelectionData, chunkStartTimeUs, chunkEndTimeUs, chunkSeekTimeUs, /* clippedEndTimeUs= */ C.TIME_UNSET, chunkIndex, /* chunkCount= */ 1, sampleOffsetUs, extractorWrapper); }
Example #27
Source File: DefaultDashChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public int getPreferredQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (fatalError != null || trackSelection.length() < 2) { return queue.size(); } return trackSelection.evaluateQueueSize(playbackPositionUs, queue); }
Example #28
Source File: DefaultDashChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public boolean onChunkLoadError( Chunk chunk, boolean cancelable, Exception e, long blacklistDurationMs) { if (!cancelable) { return false; } if (playerTrackEmsgHandler != null && playerTrackEmsgHandler.maybeRefreshManifestOnLoadingError(chunk)) { return true; } // Workaround for missing segment at the end of the period if (!manifest.dynamic && chunk instanceof MediaChunk && e instanceof InvalidResponseCodeException && ((InvalidResponseCodeException) e).responseCode == 404) { RepresentationHolder representationHolder = representationHolders[trackSelection.indexOf(chunk.trackFormat)]; int segmentCount = representationHolder.getSegmentCount(); if (segmentCount != DashSegmentIndex.INDEX_UNBOUNDED && segmentCount != 0) { long lastAvailableSegmentNum = representationHolder.getFirstSegmentNum() + segmentCount - 1; if (((MediaChunk) chunk).getNextChunkIndex() > lastAvailableSegmentNum) { missingLastSegment = true; return true; } } } return blacklistDurationMs != C.TIME_UNSET && trackSelection.blacklist(trackSelection.indexOf(chunk.trackFormat), blacklistDurationMs); }
Example #29
Source File: DefaultDashChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private long getSegmentNum( RepresentationHolder representationHolder, @Nullable MediaChunk previousChunk, long loadPositionUs, long firstAvailableSegmentNum, long lastAvailableSegmentNum) { return previousChunk != null ? previousChunk.getNextChunkIndex() : Util.constrainValue( representationHolder.getSegmentNum(loadPositionUs), firstAvailableSegmentNum, lastAvailableSegmentNum); }
Example #30
Source File: DefaultSsChunkSource.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public int getPreferredQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) { if (fatalError != null || trackSelection.length() < 2) { return queue.size(); } return trackSelection.evaluateQueueSize(playbackPositionUs, queue); }