Automated rollback of changelist 166843123.
*** Reason for rollback *** Doesn't work because trackOutputProvider can be null when extracting init data. *** Original change description *** Don't copy primary-track format to non-primary tracks Copying non-primary-track formats to non-primary tracks looks non-trivial (I tried; went down a dead-end), so leaving that for now. *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=166883654
This commit is contained in:
parent
55e928f75a
commit
d9cd13ce74
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.google.android.exoplayer2.source.chunk;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import com.google.android.exoplayer2.extractor.DummyTrackOutput;
|
||||
import com.google.android.exoplayer2.extractor.TrackOutput;
|
||||
@ -33,23 +32,12 @@ import com.google.android.exoplayer2.source.chunk.ChunkExtractorWrapper.TrackOut
|
||||
private final SampleQueue[] sampleQueues;
|
||||
|
||||
/**
|
||||
* @param primaryTrackType The type of the primary track.
|
||||
* @param primarySampleQueue The primary track sample queues.
|
||||
* @param embeddedTrackTypes The types of any embedded tracks, or null.
|
||||
* @param embeddedSampleQueues The track sample queues for any embedded tracks, or null.
|
||||
* @param trackTypes The track types of the individual track outputs.
|
||||
* @param sampleQueues The individual sample queues.
|
||||
*/
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public BaseMediaChunkOutput(int primaryTrackType, SampleQueue primarySampleQueue,
|
||||
@Nullable int[] embeddedTrackTypes, @Nullable SampleQueue[] embeddedSampleQueues) {
|
||||
int embeddedTrackCount = embeddedTrackTypes == null ? 0 : embeddedTrackTypes.length;
|
||||
trackTypes = new int[1 + embeddedTrackCount];
|
||||
sampleQueues = new SampleQueue[1 + embeddedTrackCount];
|
||||
trackTypes[0] = primaryTrackType;
|
||||
sampleQueues[0] = primarySampleQueue;
|
||||
for (int i = 0; i < embeddedTrackCount; i++) {
|
||||
trackTypes[i + 1] = embeddedTrackTypes[i];
|
||||
sampleQueues[i + 1] = embeddedSampleQueues[i];
|
||||
}
|
||||
public BaseMediaChunkOutput(int[] trackTypes, SampleQueue[] sampleQueues) {
|
||||
this.trackTypes = trackTypes;
|
||||
this.sampleQueues = sampleQueues;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,11 +51,6 @@ import com.google.android.exoplayer2.source.chunk.ChunkExtractorWrapper.TrackOut
|
||||
return new DummyTrackOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrimaryTrack(int type) {
|
||||
return type == trackTypes[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current absolute write indices of the individual sample queues.
|
||||
*/
|
||||
|
@ -45,22 +45,13 @@ public final class ChunkExtractorWrapper implements ExtractorOutput {
|
||||
* <p>
|
||||
* The same {@link TrackOutput} is returned if multiple calls are made with the same {@code id}.
|
||||
*
|
||||
* @param id The track identifier.
|
||||
* @param type The track type. Typically one of the {@link com.google.android.exoplayer2.C}
|
||||
* {@code TRACK_TYPE_*} constants.
|
||||
* @param id A track identifier.
|
||||
* @param type The type of the track. Typically one of the
|
||||
* {@link com.google.android.exoplayer2.C} {@code TRACK_TYPE_*} constants.
|
||||
* @return The {@link TrackOutput} for the given track identifier.
|
||||
*/
|
||||
TrackOutput track(int id, int type);
|
||||
|
||||
/**
|
||||
* Returns whether the specified type corresponds to the primary track.
|
||||
*
|
||||
* @param type The track type. Typically one of the {@link com.google.android.exoplayer2.C}
|
||||
* {@code TRACK_TYPE_*} constants.
|
||||
* @return Whether {@code type} corresponds to the primary track.
|
||||
*/
|
||||
boolean isPrimaryTrack(int type);
|
||||
|
||||
}
|
||||
|
||||
public final Extractor extractor;
|
||||
@ -155,7 +146,6 @@ public final class ChunkExtractorWrapper implements ExtractorOutput {
|
||||
private final Format manifestFormat;
|
||||
|
||||
public Format sampleFormat;
|
||||
private boolean isPrimaryTrack;
|
||||
private TrackOutput trackOutput;
|
||||
|
||||
public BindingTrackOutput(int id, int type, Format manifestFormat) {
|
||||
@ -169,17 +159,17 @@ public final class ChunkExtractorWrapper implements ExtractorOutput {
|
||||
trackOutput = new DummyTrackOutput();
|
||||
return;
|
||||
}
|
||||
isPrimaryTrack = trackOutputProvider.isPrimaryTrack(type);
|
||||
trackOutput = trackOutputProvider.track(id, type);
|
||||
if (sampleFormat != null) {
|
||||
if (trackOutput != null) {
|
||||
trackOutput.format(sampleFormat);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void format(Format format) {
|
||||
// TODO: Non-primary tracks should be copied with data from their own manifest formats.
|
||||
sampleFormat = isPrimaryTrack ? format.copyWithManifestFormatInfo(manifestFormat) : format;
|
||||
// TODO: This should only happen for the primary track. Additional metadata/text tracks need
|
||||
// to be copied with different manifest derived formats.
|
||||
sampleFormat = format.copyWithManifestFormatInfo(manifestFormat);
|
||||
trackOutput.format(sampleFormat);
|
||||
}
|
||||
|
||||
|
@ -87,15 +87,21 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
||||
int embeddedTrackCount = embeddedTrackTypes == null ? 0 : embeddedTrackTypes.length;
|
||||
embeddedSampleQueues = new SampleQueue[embeddedTrackCount];
|
||||
embeddedTracksSelected = new boolean[embeddedTrackCount];
|
||||
int[] trackTypes = new int[1 + embeddedTrackCount];
|
||||
SampleQueue[] sampleQueues = new SampleQueue[1 + embeddedTrackCount];
|
||||
|
||||
primarySampleQueue = new SampleQueue(allocator);
|
||||
trackTypes[0] = primaryTrackType;
|
||||
sampleQueues[0] = primarySampleQueue;
|
||||
|
||||
for (int i = 0; i < embeddedTrackCount; i++) {
|
||||
SampleQueue sampleQueue = new SampleQueue(allocator);
|
||||
embeddedSampleQueues[i] = sampleQueue;
|
||||
sampleQueues[i + 1] = sampleQueue;
|
||||
trackTypes[i + 1] = embeddedTrackTypes[i];
|
||||
}
|
||||
|
||||
mediaChunkOutput = new BaseMediaChunkOutput(primaryTrackType, primarySampleQueue,
|
||||
embeddedTrackTypes, embeddedSampleQueues);
|
||||
mediaChunkOutput = new BaseMediaChunkOutput(trackTypes, sampleQueues);
|
||||
pendingResetPositionUs = positionUs;
|
||||
lastSeekPositionUs = positionUs;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user