Make DefaultDashChunkSource more robust against empty segment timelines
Segment timelines are technically allowed to be empty, but not all places add the necessary checks. Issue: google/ExoPlayer#11014 PiperOrigin-RevId: 514722205
This commit is contained in:
parent
f07e6b63ea
commit
788132b9dc
@ -23,6 +23,9 @@
|
|||||||
instead.
|
instead.
|
||||||
* Remove `Transformer.startTransformation(MediaItem,
|
* Remove `Transformer.startTransformation(MediaItem,
|
||||||
ParcelFileDescriptor)`.
|
ParcelFileDescriptor)`.
|
||||||
|
* DASH:
|
||||||
|
* Fix handling of empty segment timelines
|
||||||
|
([#11014](https://github.com/google/ExoPlayer/issues/11014)).
|
||||||
* Remove deprecated symbols:
|
* Remove deprecated symbols:
|
||||||
* Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder`
|
* Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder`
|
||||||
instead.
|
instead.
|
||||||
|
@ -236,9 +236,12 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
// Segments are aligned across representations, so any segment index will do.
|
// Segments are aligned across representations, so any segment index will do.
|
||||||
for (RepresentationHolder representationHolder : representationHolders) {
|
for (RepresentationHolder representationHolder : representationHolders) {
|
||||||
if (representationHolder.segmentIndex != null) {
|
if (representationHolder.segmentIndex != null) {
|
||||||
|
long segmentCount = representationHolder.getSegmentCount();
|
||||||
|
if (segmentCount == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
long segmentNum = representationHolder.getSegmentNum(positionUs);
|
long segmentNum = representationHolder.getSegmentNum(positionUs);
|
||||||
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
|
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
|
||||||
long segmentCount = representationHolder.getSegmentCount();
|
|
||||||
long secondSyncUs =
|
long secondSyncUs =
|
||||||
firstSyncUs < positionUs
|
firstSyncUs < positionUs
|
||||||
&& (segmentCount == DashSegmentIndex.INDEX_UNBOUNDED
|
&& (segmentCount == DashSegmentIndex.INDEX_UNBOUNDED
|
||||||
@ -594,7 +597,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private long getAvailableLiveDurationUs(long nowUnixTimeUs, long playbackPositionUs) {
|
private long getAvailableLiveDurationUs(long nowUnixTimeUs, long playbackPositionUs) {
|
||||||
if (!manifest.dynamic) {
|
if (!manifest.dynamic || representationHolders[0].getSegmentCount() == 0) {
|
||||||
return C.TIME_UNSET;
|
return C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
long lastSegmentNum = representationHolders[0].getLastAvailableSegmentNum(nowUnixTimeUs);
|
long lastSegmentNum = representationHolders[0].getLastAvailableSegmentNum(nowUnixTimeUs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user