Skip to content

Commit

Permalink
test: Fix StreamingEngine tests on Tizen (#4812)
Browse files Browse the repository at this point in the history
For some unknown reason, using precise durations for these audio
segments on Tizen creates gaps that can't be survived. I don't know why
that creates a 150ms gap, and I don't know why we can't seem to jump
over it. It feels very much like a bug in Tizen itself.

Experimentally, I found that rounding these durations to 10s even
removes the gap completely. I tried many other things, but this is the
only reasonable thing I have found that works.

More details on my investigations can be found in the issue on GitHub.

This change in durations exposed some brittle tests in Player which had
to be adjusted to be more robust.

Closes #4806
  • Loading branch information
joeyparrish authored Dec 13, 2022
1 parent da0b818 commit 1bf5ef1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions test/player_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ describe('Player', () => {
expect(getBufferedBehind()).toBe(20); // Buffered to start still.
video.currentTime = 50;
await waitUntilBuffered(30);
expect(getBufferedBehind()).toBeLessThan(30);
expect(getBufferedBehind()).toBeLessThan(40); // 30 + segment_size

player.configure('streaming.bufferBehind', 10);
// We only evict content when we append a segment, so increase the
Expand All @@ -997,15 +997,22 @@ describe('Player', () => {
}

async function waitUntilBuffered(amount) {
for (let i = 0; i < 25; i++) {
for (let i = 0; i < 50; i++) {
// We buffer from an internal segment, so this shouldn't take long to
// buffer.
await Util.delay(0.1); // eslint-disable-line no-await-in-loop
if (getBufferedAhead() >= amount) {
return;
}
}
throw new Error('Timeout waiting to buffer');

const ranges =
shaka.media.TimeRangesUtils.getBufferedInfo(video.buffered);
const currentTime = video.currentTime;
const target = currentTime + amount;

throw new Error('Timeout waiting to buffer! ' +
JSON.stringify({ranges, currentTime, target}));
}
}); // describe('buffering')

Expand Down
4 changes: 2 additions & 2 deletions test/test/util/test_scheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ const sintelAudioSegment = {
mdhdOffset: 0x1b6,
segmentUri: '/base/test/test/assets/sintel-audio-segment.mp4',
tfdtOffset: 0x3c,
segmentDuration: 10.005,
segmentDuration: 10,
mimeType: 'audio/mp4',
codecs: 'mp4a.40.2',
};
Expand All @@ -439,7 +439,7 @@ const sintelEncryptedAudio = {
mdhdOffset: 0x1b6,
segmentUri: '/base/test/test/assets/encrypted-sintel-audio-segment.mp4',
tfdtOffset: 0x3c,
segmentDuration: 10.005,
segmentDuration: 10,
mimeType: 'audio/mp4',
codecs: 'mp4a.40.2',
initData:
Expand Down

0 comments on commit 1bf5ef1

Please sign in to comment.