mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
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:
1 parent
5cce9d0705
commit
186f8b76d9
5 files changed
+106
-8
No files matched your search
+14
-5
@@ -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,
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user