mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
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
(cherry picked from commit 788132b9dc)
This commit is contained in:
parent
4666d57b12
commit
a94fb21dcb
1 changed files with 5 additions and 2 deletions
|
|
@ -236,9 +236,12 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||
// Segments are aligned across representations, so any segment index will do.
|
||||
for (RepresentationHolder representationHolder : representationHolders) {
|
||||
if (representationHolder.segmentIndex != null) {
|
||||
long segmentCount = representationHolder.getSegmentCount();
|
||||
if (segmentCount == 0) {
|
||||
continue;
|
||||
}
|
||||
long segmentNum = representationHolder.getSegmentNum(positionUs);
|
||||
long firstSyncUs = representationHolder.getSegmentStartTimeUs(segmentNum);
|
||||
long segmentCount = representationHolder.getSegmentCount();
|
||||
long secondSyncUs =
|
||||
firstSyncUs < positionUs
|
||||
&& (segmentCount == DashSegmentIndex.INDEX_UNBOUNDED
|
||||
|
|
@ -594,7 +597,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||
}
|
||||
|
||||
private long getAvailableLiveDurationUs(long nowUnixTimeUs, long playbackPositionUs) {
|
||||
if (!manifest.dynamic) {
|
||||
if (!manifest.dynamic || representationHolders[0].getSegmentCount() == 0) {
|
||||
return C.TIME_UNSET;
|
||||
}
|
||||
long lastSegmentNum = representationHolders[0].getLastAvailableSegmentNum(nowUnixTimeUs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue