Fix bug where sourceId wasn't set for the first chunk

The sample queues haven't been created when the first init call
occurs. In this case we need to set sourceId when we subsequently
create the queues.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467538
This commit is contained in:
olly 2018-07-13 07:13:46 -07:00 committed by Oliver Woodman
parent ef728178a8
commit 450448b220

View File

@ -140,6 +140,7 @@ import java.util.List;
// Accessed only by the loading thread.
private boolean tracksEnded;
private long sampleOffsetUs;
private int chunkUid;
/**
* @param trackType The type of the track. One of the {@link C} {@code TRACK_TYPE_*} constants.
@ -698,6 +699,7 @@ import java.util.List;
audioSampleQueueMappingDone = false;
videoSampleQueueMappingDone = false;
}
this.chunkUid = chunkUid;
for (SampleQueue sampleQueue : sampleQueues) {
sampleQueue.sourceId(chunkUid);
}
@ -752,6 +754,7 @@ import java.util.List;
}
}
SampleQueue trackOutput = new SampleQueue(allocator);
trackOutput.sourceId(chunkUid);
trackOutput.setSampleOffsetUs(sampleOffsetUs);
trackOutput.setUpstreamFormatChangeListener(this);
sampleQueueTrackIds = Arrays.copyOf(sampleQueueTrackIds, trackCount + 1);