Explicitly support MediaChunk.chunkIndex = C.INDEX_UNSET. This is common in

Manifestless streams.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198445216
This commit is contained in:
sammon 2018-05-29 13:09:42 -07:00 committed by Oliver Woodman
parent 25f4ee22d6
commit 3639f1281a
4 changed files with 7 additions and 7 deletions

View File

@ -44,7 +44,7 @@ public abstract class BaseMediaChunk extends MediaChunk {
* @param endTimeUs The end time of the media contained by the chunk, in microseconds.
* @param seekTimeUs The media time from which output will begin, or {@link C#TIME_UNSET} if the
* whole chunk should be output.
* @param chunkIndex The index of the chunk.
* @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known.
*/
public BaseMediaChunk(
DataSource dataSource,

View File

@ -49,7 +49,7 @@ public class ContainerMediaChunk extends BaseMediaChunk {
* @param endTimeUs The end time of the media contained by the chunk, in microseconds.
* @param seekTimeUs The media time from which output will begin, or {@link C#TIME_UNSET} if the
* whole chunk should be output.
* @param chunkIndex The index of the chunk.
* @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known.
* @param chunkCount The number of chunks in the underlying media that are spanned by this
* instance. Normally equal to one, but may be larger if multiple chunks as defined by the
* underlying media are being merged into a single load.

View File

@ -26,7 +26,7 @@ import com.google.android.exoplayer2.util.Assertions;
*/
public abstract class MediaChunk extends Chunk {
/** The chunk index. */
/** The chunk index, or {@link C#INDEX_UNSET} if it is not known. */
public final long chunkIndex;
/**
@ -37,7 +37,7 @@ public abstract class MediaChunk extends Chunk {
* @param trackSelectionData See {@link #trackSelectionData}.
* @param startTimeUs The start time of the media contained by the chunk, in microseconds.
* @param endTimeUs The end time of the media contained by the chunk, in microseconds.
* @param chunkIndex The index of the chunk.
* @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known.
*/
public MediaChunk(
DataSource dataSource,
@ -54,9 +54,9 @@ public abstract class MediaChunk extends Chunk {
this.chunkIndex = chunkIndex;
}
/** Returns the next chunk index. */
/** Returns the next chunk index or {@link C#INDEX_UNSET} if it is not known. */
public long getNextChunkIndex() {
return chunkIndex + 1;
return chunkIndex != C.INDEX_UNSET ? chunkIndex + 1 : C.INDEX_UNSET;
}
/**

View File

@ -45,7 +45,7 @@ public final class SingleSampleMediaChunk extends BaseMediaChunk {
* @param trackSelectionData See {@link #trackSelectionData}.
* @param startTimeUs The start time of the media contained by the chunk, in microseconds.
* @param endTimeUs The end time of the media contained by the chunk, in microseconds.
* @param chunkIndex The index of the chunk.
* @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known.
* @param trackType The type of the chunk. Typically one of the {@link C} {@code TRACK_TYPE_*}
* constants.
* @param sampleFormat The {@link Format} of the sample in the chunk.