Skip to content

Commit 82eda16

Browse files
joeyparrishAnteWall
authored andcommitted
Fix edge case in DASH tests
During a refactor ("Replace find/get callbacks with SegmentIndex"), this test changed from using a hard-coded segment position to looking one up based on the live edge. But using the exact live edge leads to some amount of flakiness. Back off the live edge enough to make sure you're not on the trailing edge of the segment. Fixes b/137286528 Change-Id: Ic4e869e8a3b1ceaf45dc14b04ea0e987bd690453
1 parent 2b6cfb0 commit 82eda16

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/dash/dash_parser_live_unit.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,11 +1029,18 @@ describe('DashParser Live', () => {
10291029

10301030
const liveEdge =
10311031
manifest.presentationTimeline.getSegmentAvailabilityEnd();
1032-
const idx = stream.segmentIndex.find(liveEdge);
10331032

1034-
// In https://github.com/google/shaka-player/issues/1204, this
1035-
// failed an assertion and returned endTime == 0.
1033+
// In https://github.com/google/shaka-player/issues/1204, a get on the
1034+
// final segment failed an assertion and returned endTime == 0.
1035+
// Find the last segment by looking just before the live edge. Looking
1036+
// right on the live edge creates test flake, and the segments are 2
1037+
// seconds in duration.
1038+
const idx = stream.segmentIndex.find(liveEdge - 0.5);
1039+
expect(idx).not.toBe(null);
1040+
1041+
// This should not throw an assertion.
10361042
const ref = stream.segmentIndex.get(idx);
1043+
// The segment's endTime should definitely not be 0.
10371044
expect(ref.endTime).toBeGreaterThan(0);
10381045
});
10391046
});

0 commit comments

Comments
 (0)