Commit a64df69f by Oliver Woodman

Refine last segment calculation.

This makes the calculation correct for the case where periodDurationMs
does not divide exactly into durationMs.
parent e5381811
...@@ -301,7 +301,7 @@ public abstract class SegmentBase { ...@@ -301,7 +301,7 @@ public abstract class SegmentBase {
return DashSegmentIndex.INDEX_UNBOUNDED; return DashSegmentIndex.INDEX_UNBOUNDED;
} else { } else {
long durationMs = (duration * 1000) / timescale; long durationMs = (duration * 1000) / timescale;
return startNumber + (int) (periodDurationMs / durationMs) - 1; return startNumber + (int) ((periodDurationMs + durationMs - 1) / durationMs) - 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment