diff --git a/tools/e2e/34-sound.mjs b/tools/e2e/34-sound.mjs index 4fb3a695..3e12186c 100644 --- a/tools/e2e/34-sound.mjs +++ b/tools/e2e/34-sound.mjs @@ -3964,9 +3964,23 @@ export async function sound(t) { // counted once it is there, so the pause is judged by what it adds. The wait after it lets the // worklet report how far it has read: until then a stretch sent counts as ahead. const headsOnly = statsBefore.streaming.held; - await waitFor(stats, (s) => s.streaming.held - headsOnly >= STREAM_SECOND_BYTES, 40); + const aheadStreamed = await waitFor(stats, (s) => s.streaming.held - headsOnly >= STREAM_SECOND_BYTES, 40); await sleep(500); const heldStreamed = await stats(); + // A runner too slow to decode never gets the second ahead and skips from the start (CI task 750, + // 0.04 s ahead, 1.1 s skipped before the pause): that is told here, not blamed on the pause. + const streamAhead = + aheadStreamed.streaming.held - headsOnly >= STREAM_SECOND_BYTES && + heldStreamed.streaming.skipped === statsBefore.streaming.skipped; + check( + 'before the pause the stream runs a second ahead, not a sample skipped', + streamAhead, + JSON.stringify({ + before: statsBefore.streaming, + ahead: aheadStreamed.streaming, + held: heldStreamed.streaming, + }), + ); await t.clickToolbar('pause'); await sleep(500); const paused = { clock: await json('__gm.sound.clock()'), state: await json('__gm.sound.clockState()') }; @@ -3988,12 +4002,15 @@ export async function sound(t) { Math.max(...(heardLong?.mix ?? [0])) > 0.01, JSON.stringify({ streaming, heardLong }), ); + // Behind before it, the pause cannot be judged by what it skips: the clock and stopping still are. check( - 'the pause holds the stream where it is, it plays on after it without a sample lost, and stopping ends it', + streamAhead + ? 'the pause holds the stream where it is, it plays on after it without a sample lost, and stopping ends it' + : 'the pause holds the clock and stopping ends it (samples not judged: the stream was behind before the pause)', paused.state === 'suspended' && pausedLater === paused.clock && resumedLong.streaming.playing === 1 && - resumedLong.streaming.skipped === heldStreamed.streaming.skipped && + (!streamAhead || resumedLong.streaming.skipped === heldStreamed.streaming.skipped) && stoppedLong.streaming.playing === 0 && stoppedLong.playing === 0, // Held before the pause too: it tells a stream that fell behind from the start from one the