use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.
the class ChunkSampleStream method onLoadCanceled.
@Override
public void onLoadCanceled(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) {
eventDispatcher.loadCanceled(loadable.dataSpec, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
if (!released) {
primarySampleQueue.reset(true);
for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
embeddedSampleQueue.reset(true);
}
callback.onContinueLoadingRequested(this);
}
}
use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.
the class ChunkSampleStream method release.
/**
* Releases the stream.
* <p>
* This method should be called when the stream is no longer required.
*/
public void release() {
primarySampleQueue.disable();
for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
embeddedSampleQueue.disable();
}
loader.release();
}
use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.
the class HlsSampleStreamWrapper method track.
// ExtractorOutput implementation. Called by the loading thread.
@Override
public DefaultTrackOutput track(int id, int type) {
if (sampleQueues.indexOfKey(id) >= 0) {
return sampleQueues.get(id);
}
DefaultTrackOutput trackOutput = new DefaultTrackOutput(allocator);
trackOutput.setUpstreamFormatChangeListener(this);
trackOutput.sourceId(upstreamChunkUid);
sampleQueues.put(id, trackOutput);
return trackOutput;
}
use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.
the class ChunkSampleStream method seekToUs.
/**
* Seeks to the specified position in microseconds.
*
* @param positionUs The seek position in microseconds.
*/
public void seekToUs(long positionUs) {
lastSeekPositionUs = positionUs;
// If we're not pending a reset, see if we can seek within the primary sample queue.
boolean seekInsideBuffer = !isPendingReset() && primarySampleQueue.skipToKeyframeBefore(positionUs, positionUs < getNextLoadPositionUs());
if (seekInsideBuffer) {
// any embedded streams as well.
while (mediaChunks.size() > 1 && mediaChunks.get(1).getFirstSampleIndex(0) <= primarySampleQueue.getReadIndex()) {
mediaChunks.removeFirst();
}
// sample queues beyond the current read position of the primary stream.
for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
embeddedSampleQueue.skipToKeyframeBefore(positionUs);
}
} else {
// We failed, and need to restart.
pendingResetPositionUs = positionUs;
loadingFinished = false;
mediaChunks.clear();
if (loader.isLoading()) {
loader.cancelLoading();
} else {
primarySampleQueue.reset(true);
for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
embeddedSampleQueue.reset(true);
}
}
}
}
use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.
the class ExtractorMediaPeriod method track.
// ExtractorOutput implementation. Called by the loading thread.
@Override
public TrackOutput track(int id, int type) {
DefaultTrackOutput trackOutput = sampleQueues.get(id);
if (trackOutput == null) {
trackOutput = new DefaultTrackOutput(allocator);
trackOutput.setUpstreamFormatChangeListener(this);
sampleQueues.put(id, trackOutput);
}
return trackOutput;
}
Aggregations