From 12eba067e4f4215b107c3d93ecfab9f23df494c4 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Tue, 13 Dec 2022 08:19:47 -0800 Subject: [PATCH] test: Fix StreamingEngine tests on Tizen (#4812) 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 --- test/player_integration.js | 13 ++++++++++--- test/test/util/test_scheme.js | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/player_integration.js b/test/player_integration.js index de6ca1f653..9561a87fae 100644 --- a/test/player_integration.js +++ b/test/player_integration.js @@ -879,7 +879,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 @@ -906,7 +906,7 @@ 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 @@ -914,7 +914,14 @@ describe('Player', () => { 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') diff --git a/test/test/util/test_scheme.js b/test/test/util/test_scheme.js index fae8e8b6a9..f972180138 100644 --- a/test/test/util/test_scheme.js +++ b/test/test/util/test_scheme.js @@ -402,7 +402,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', }; @@ -428,7 +428,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: