Don't resolve UtcTiming element for static manifests

It doesn't do anything useful in this case.

PiperOrigin-RevId: 223516909
This commit is contained in:
olly 2018-11-30 16:08:41 +00:00 committed by Oliver Woodman
parent ea483f8c8e
commit beae7c9df5
2 changed files with 9 additions and 9 deletions

View File

@ -65,7 +65,7 @@ import java.util.List;
private final DashChunkSource.Factory chunkSourceFactory; private final DashChunkSource.Factory chunkSourceFactory;
private final @Nullable TransferListener transferListener; private final @Nullable TransferListener transferListener;
private final LoadErrorHandlingPolicy loadErrorHandlingPolicy; private final LoadErrorHandlingPolicy loadErrorHandlingPolicy;
private final long elapsedRealtimeOffset; private final long elapsedRealtimeOffsetMs;
private final LoaderErrorThrower manifestLoaderErrorThrower; private final LoaderErrorThrower manifestLoaderErrorThrower;
private final Allocator allocator; private final Allocator allocator;
private final TrackGroupArray trackGroups; private final TrackGroupArray trackGroups;
@ -93,7 +93,7 @@ import java.util.List;
@Nullable TransferListener transferListener, @Nullable TransferListener transferListener,
LoadErrorHandlingPolicy loadErrorHandlingPolicy, LoadErrorHandlingPolicy loadErrorHandlingPolicy,
EventDispatcher eventDispatcher, EventDispatcher eventDispatcher,
long elapsedRealtimeOffset, long elapsedRealtimeOffsetMs,
LoaderErrorThrower manifestLoaderErrorThrower, LoaderErrorThrower manifestLoaderErrorThrower,
Allocator allocator, Allocator allocator,
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
@ -105,7 +105,7 @@ import java.util.List;
this.transferListener = transferListener; this.transferListener = transferListener;
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy; this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
this.eventDispatcher = eventDispatcher; this.eventDispatcher = eventDispatcher;
this.elapsedRealtimeOffset = elapsedRealtimeOffset; this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
this.manifestLoaderErrorThrower = manifestLoaderErrorThrower; this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
this.allocator = allocator; this.allocator = allocator;
this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
@ -593,7 +593,7 @@ import java.util.List;
trackGroupInfo.adaptationSetIndices, trackGroupInfo.adaptationSetIndices,
selection, selection,
trackGroupInfo.trackType, trackGroupInfo.trackType,
elapsedRealtimeOffset, elapsedRealtimeOffsetMs,
enableEventMessageTrack, enableEventMessageTrack,
enableCea608Track, enableCea608Track,
trackPlayerEmsgHandler, trackPlayerEmsgHandler,

View File

@ -710,17 +710,17 @@ public final class DashMediaSource extends BaseMediaSource {
loadable.bytesLoaded()); loadable.bytesLoaded());
DashManifest newManifest = loadable.getResult(); DashManifest newManifest = loadable.getResult();
int periodCount = manifest == null ? 0 : manifest.getPeriodCount(); int oldPeriodCount = manifest == null ? 0 : manifest.getPeriodCount();
int removedPeriodCount = 0; int removedPeriodCount = 0;
long newFirstPeriodStartTimeMs = newManifest.getPeriod(0).startMs; long newFirstPeriodStartTimeMs = newManifest.getPeriod(0).startMs;
while (removedPeriodCount < periodCount while (removedPeriodCount < oldPeriodCount
&& manifest.getPeriod(removedPeriodCount).startMs < newFirstPeriodStartTimeMs) { && manifest.getPeriod(removedPeriodCount).startMs < newFirstPeriodStartTimeMs) {
removedPeriodCount++; removedPeriodCount++;
} }
if (newManifest.dynamic) { if (newManifest.dynamic) {
boolean isManifestStale = false; boolean isManifestStale = false;
if (periodCount - removedPeriodCount > newManifest.getPeriodCount()) { if (oldPeriodCount - removedPeriodCount > newManifest.getPeriodCount()) {
// After discarding old periods, we should never have more periods than listed in the new // After discarding old periods, we should never have more periods than listed in the new
// manifest. That would mean that a previously announced period is no longer advertised. If // manifest. That would mean that a previously announced period is no longer advertised. If
// this condition occurs, assume that we are hitting a manifest server that is out of sync // this condition occurs, assume that we are hitting a manifest server that is out of sync
@ -770,8 +770,8 @@ public final class DashMediaSource extends BaseMediaSource {
} }
} }
if (periodCount == 0) { if (oldPeriodCount == 0) {
if (manifest.utcTiming != null) { if (manifest.dynamic && manifest.utcTiming != null) {
resolveUtcTimingElement(manifest.utcTiming); resolveUtcTimingElement(manifest.utcTiming);
} else { } else {
processManifest(true); processManifest(true);