Update SampleQueue.sourceId to be a long rather than an int.
This simplifies usage of 64-bit sequence numbers. PiperOrigin-RevId: 508107588
This commit is contained in:
parent
fedb74907e
commit
e0ad4ed828
@ -26,6 +26,9 @@
|
||||
* Add `ConcatenatingMediaSource2` that allows combining multiple media
|
||||
items into a single window
|
||||
([#247](https://github.com/androidx/media/issues/247)).
|
||||
* Update `SampleQueue` to store `sourceId` as a `long` rather than an
|
||||
`int`. This changes the signatures of public methods
|
||||
`SampleQueue.sourceId` and `SampleQueue.peekSourceId`.
|
||||
* Extractors:
|
||||
* Throw a ParserException instead of a NullPointerException if the sample
|
||||
table (stbl) is missing a required sample description (stsd) when
|
||||
|
@ -81,7 +81,7 @@ public class SampleQueue implements TrackOutput {
|
||||
@Nullable private DrmSession currentDrmSession;
|
||||
|
||||
private int capacity;
|
||||
private int[] sourceIds;
|
||||
private long[] sourceIds;
|
||||
private long[] offsets;
|
||||
private int[] sizes;
|
||||
private int[] flags;
|
||||
@ -102,7 +102,7 @@ public class SampleQueue implements TrackOutput {
|
||||
private boolean upstreamFormatAdjustmentRequired;
|
||||
@Nullable private Format unadjustedUpstreamFormat;
|
||||
@Nullable private Format upstreamFormat;
|
||||
private int upstreamSourceId;
|
||||
private long upstreamSourceId;
|
||||
private boolean upstreamAllSamplesAreSyncSamples;
|
||||
private boolean loggedUnexpectedNonSyncSample;
|
||||
|
||||
@ -168,7 +168,7 @@ public class SampleQueue implements TrackOutput {
|
||||
sampleDataQueue = new SampleDataQueue(allocator);
|
||||
extrasHolder = new SampleExtrasHolder();
|
||||
capacity = SAMPLE_CAPACITY_INCREMENT;
|
||||
sourceIds = new int[capacity];
|
||||
sourceIds = new long[capacity];
|
||||
offsets = new long[capacity];
|
||||
timesUs = new long[capacity];
|
||||
flags = new int[capacity];
|
||||
@ -240,7 +240,7 @@ public class SampleQueue implements TrackOutput {
|
||||
*
|
||||
* @param sourceId The source identifier.
|
||||
*/
|
||||
public final void sourceId(int sourceId) {
|
||||
public final void sourceId(long sourceId) {
|
||||
upstreamSourceId = sourceId;
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ public class SampleQueue implements TrackOutput {
|
||||
*
|
||||
* @return The source id.
|
||||
*/
|
||||
public final synchronized int peekSourceId() {
|
||||
public final synchronized long peekSourceId() {
|
||||
int relativeReadIndex = getRelativeIndex(readPosition);
|
||||
return hasNextSample() ? sourceIds[relativeReadIndex] : upstreamSourceId;
|
||||
}
|
||||
@ -828,7 +828,7 @@ public class SampleQueue implements TrackOutput {
|
||||
if (length == capacity) {
|
||||
// Increase the capacity.
|
||||
int newCapacity = capacity + SAMPLE_CAPACITY_INCREMENT;
|
||||
int[] newSourceIds = new int[newCapacity];
|
||||
long[] newSourceIds = new long[newCapacity];
|
||||
long[] newOffsets = new long[newCapacity];
|
||||
long[] newTimesUs = new long[newCapacity];
|
||||
int[] newFlags = new int[newCapacity];
|
||||
|
@ -71,6 +71,7 @@ import androidx.media3.extractor.metadata.emsg.EventMessageDecoder;
|
||||
import androidx.media3.extractor.metadata.id3.PrivFrame;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -664,7 +665,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
Format format = Assertions.checkNotNull(formatHolder.format);
|
||||
if (sampleQueueIndex == primarySampleQueueIndex) {
|
||||
// Fill in primary sample format with information from the track format.
|
||||
int chunkUid = sampleQueues[sampleQueueIndex].peekSourceId();
|
||||
int chunkUid = Ints.checkedCast(sampleQueues[sampleQueueIndex].peekSourceId());
|
||||
int chunkIndex = 0;
|
||||
while (chunkIndex < mediaChunks.size() && mediaChunks.get(chunkIndex).uid != chunkUid) {
|
||||
chunkIndex++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user