MediaPeriod.getDurationUs must report duration when known.
As per the spec of MediaPeriod.getDurationUs, when a live stream ends we need to start returning the correct final duration. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=128471183
This commit is contained in:
parent
c5aa376bc4
commit
dae87b66dd
@ -47,7 +47,6 @@ import java.util.List;
|
|||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final long elapsedRealtimeOffset;
|
private final long elapsedRealtimeOffset;
|
||||||
private final Loader loader;
|
private final Loader loader;
|
||||||
private final long durationUs;
|
|
||||||
private final TrackGroupArray trackGroups;
|
private final TrackGroupArray trackGroups;
|
||||||
|
|
||||||
private ChunkSampleStream<DashChunkSource>[] sampleStreams;
|
private ChunkSampleStream<DashChunkSource>[] sampleStreams;
|
||||||
@ -55,6 +54,7 @@ import java.util.List;
|
|||||||
private Callback callback;
|
private Callback callback;
|
||||||
private Allocator allocator;
|
private Allocator allocator;
|
||||||
private DashManifest manifest;
|
private DashManifest manifest;
|
||||||
|
private long durationUs;
|
||||||
private int index;
|
private int index;
|
||||||
private Period period;
|
private Period period;
|
||||||
|
|
||||||
@ -76,6 +76,7 @@ import java.util.List;
|
|||||||
public void updateManifest(DashManifest manifest, int index) {
|
public void updateManifest(DashManifest manifest, int index) {
|
||||||
this.manifest = manifest;
|
this.manifest = manifest;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
durationUs = manifest.dynamic ? C.UNSET_TIME_US : manifest.getPeriodDuration(index) * 1000;
|
||||||
period = manifest.getPeriod(index);
|
period = manifest.getPeriod(index);
|
||||||
if (sampleStreams != null) {
|
if (sampleStreams != null) {
|
||||||
for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) {
|
for (ChunkSampleStream<DashChunkSource> sampleStream : sampleStreams) {
|
||||||
|
@ -48,7 +48,6 @@ import java.util.List;
|
|||||||
private final Loader manifestLoader;
|
private final Loader manifestLoader;
|
||||||
private final int minLoadableRetryCount;
|
private final int minLoadableRetryCount;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final long durationUs;
|
|
||||||
private final TrackGroupArray trackGroups;
|
private final TrackGroupArray trackGroups;
|
||||||
private final TrackEncryptionBox[] trackEncryptionBoxes;
|
private final TrackEncryptionBox[] trackEncryptionBoxes;
|
||||||
|
|
||||||
@ -65,7 +64,6 @@ import java.util.List;
|
|||||||
this.manifestLoader = manifestLoader;
|
this.manifestLoader = manifestLoader;
|
||||||
this.minLoadableRetryCount = minLoadableRetryCount;
|
this.minLoadableRetryCount = minLoadableRetryCount;
|
||||||
this.eventDispatcher = eventDispatcher;
|
this.eventDispatcher = eventDispatcher;
|
||||||
durationUs = manifest.durationUs;
|
|
||||||
trackGroups = buildTrackGroups(manifest);
|
trackGroups = buildTrackGroups(manifest);
|
||||||
ProtectionElement protectionElement = manifest.protectionElement;
|
ProtectionElement protectionElement = manifest.protectionElement;
|
||||||
if (protectionElement != null) {
|
if (protectionElement != null) {
|
||||||
@ -103,7 +101,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDurationUs() {
|
public long getDurationUs() {
|
||||||
return durationUs;
|
return manifest.durationUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user