Skip to content

SegmentBase calculate segment count in accurate. #8804

@zgzong

Description

@zgzong

When play or download a number-based VoD stream, player report the last segment is missing.

The stream information:
mediaPresentationDuration="PT2931.820S"

  • ExoPlayer version number
    2.13.1

  • Android version
    all os version

  • Android device
    Samsung tablet SMP610

SegmentBase.java
public int getSegmentCount(long periodDurationUs) ... long durationUs = (duration * C.MICROS_PER_SECOND) / timescale; return (int) Util.ceilDivide(periodDurationUs, durationUs);

long durationUs = (179989 * 1000000) / 90000 = (long) 1,999,877.7777777777777777777777778 = 1999877
Util.ceilDivide(periodDurationUs, durationUs) = Util.ceilDivide( 2931820000 / 1999877) = 1467

Actually:
Based on https://dashif-documents.azurewebsites.net//DASH-IF-IOP/pull/210/DASH-IF-IOP.html#timing-addressing-simple-to-explicit
SegmentCount = Ceil(AsSeconds(Period@duration) / ( SegmentTemplate@duration / SegmentTemplate@timescale))
= Ceil ( 2931.820 / (179989 / 90000) ) = 1466.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions