Scenes: a clip restarted without a media gate plays its hold out

A resumed hold waited only its rest unless the layer gave a media gate,
and only trimmed clips have one, so an untrimmed clip started again (as
on Gyirong) was cut short. The layer now says when a run going on from a
seek started its clip again, and the hold then plays out as from its
start: through the media gate when there is one, else for the whole hold.
This commit is contained in:
Sameh Khamis committed 2026-11-16 14:20:55 -08:00
1 parent 5cce9d0705
commit 186f8b76d9
5 files changed
+106 -8

No files matched your search

+14 -5
View File
@@ -2957,11 +2957,20 @@ export class SceneDirector {
]
: [];
});
// Resumed inside the hold, its layers play on from that moment: a clip
// they started again is waited for as in any hold; otherwise only the
// rest of the hold is left to wait.
const resumed = resume?.holdElapsedSec > 0;
if (resumed && !readers.some(({ read }) => read()?.pending === true)) {
// Resumed inside the hold, its layers play on from that moment. A clip
// they started again plays the hold out as from its start (its media
// gate, or the shot's whole hold for a clip without one); otherwise only
// the rest of the hold is left to wait.
const restartedClip =
resume?.holdElapsedSec > 0 &&
Object.entries(this._layerStatesForShot(scene, shot)).some(
([id, state]) =>
state.enabled &&
this.dataManager?.layers
?.get(id)
?.module?.sceneShotRestartsMedia?.(state.params?.beatId) === true,
);
if (resume?.holdElapsedSec > 0 && !restartedClip) {
await this._sleep(
Math.max(0, resume.holdDurationSec - resume.holdElapsedSec) * 1000,
token,
+3 -1
View File
@@ -2140,6 +2140,7 @@ test('a hold resumed partway waits for a clip that starts again, else only its r
let reads = 0;
const module = {
getSceneShotMediaHold: () => ({ pending: reads++ < pendingReads, maxWaitMs: 20000 }),
sceneShotRestartsMedia: () => pendingReads > 0,
};
const waits = [];
await SceneDirector.prototype._holdShot.call(
@@ -2158,7 +2159,8 @@ test('a hold resumed partway waits for a clip that starts again, else only its r
return waits;
};
// The clip plays again: the hold polls until it is done, as any hold does.
assert.deepEqual(await hold(4), [70, 70]);
const polls = await hold(4);
assert.ok(polls.length && polls.every((ms) => ms === 70), String(polls));
// The moment was past the clip: only the rest of the hold.
assert.deepEqual(await hold(0), [2000]);
});