@omnimedia/omnitool 1.1.0-90 → 1.1.0-91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/s/timeline/renderers/export/parts/cursor.ts +18 -0
- package/x/demo/demo.bundle.min.js +48 -48
- package/x/demo/demo.bundle.min.js.map +3 -3
- package/x/index.html +2 -2
- package/x/tests.bundle.min.js +49 -49
- package/x/tests.bundle.min.js.map +3 -3
- package/x/tests.html +1 -1
- package/x/timeline/renderers/export/parts/cursor.js +16 -0
- package/x/timeline/renderers/export/parts/cursor.js.map +1 -1
package/package.json
CHANGED
|
@@ -159,6 +159,9 @@ export class ReverseCursorVisualSampler extends BaseVisualSampler {
|
|
|
159
159
|
let input: Input | null = null
|
|
160
160
|
let sink: VideoSampleSink | null = null
|
|
161
161
|
let prefetchPromise: Promise<{frames: VideoFrame[], windowStart: number, windowEnd: number}> | null = null
|
|
162
|
+
let activeFetches = 0
|
|
163
|
+
let idle: Promise<void> = Promise.resolve()
|
|
164
|
+
let resolveIdle: (() => void) | null = null
|
|
162
165
|
let canceled = false
|
|
163
166
|
|
|
164
167
|
const clear = () => {
|
|
@@ -167,6 +170,18 @@ export class ReverseCursorVisualSampler extends BaseVisualSampler {
|
|
|
167
170
|
frames = []
|
|
168
171
|
}
|
|
169
172
|
|
|
173
|
+
const startFetch = () => {
|
|
174
|
+
if (activeFetches++ === 0)
|
|
175
|
+
idle = new Promise<void>(resolve => resolveIdle = resolve)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const endFetch = () => {
|
|
179
|
+
if (--activeFetches === 0) {
|
|
180
|
+
resolveIdle?.()
|
|
181
|
+
resolveIdle = null
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
170
185
|
const getSink = async () => {
|
|
171
186
|
if (sink) return sink
|
|
172
187
|
|
|
@@ -184,6 +199,7 @@ export class ReverseCursorVisualSampler extends BaseVisualSampler {
|
|
|
184
199
|
}
|
|
185
200
|
|
|
186
201
|
const fetchFrames = async (targetUs: number) => {
|
|
202
|
+
startFetch()
|
|
187
203
|
const wEnd = Math.min(endUs, targetUs + 1)
|
|
188
204
|
const wStart = Math.max(startUs, wEnd - windowUs)
|
|
189
205
|
const newFrames: VideoFrame[] = []
|
|
@@ -196,6 +212,7 @@ export class ReverseCursorVisualSampler extends BaseVisualSampler {
|
|
|
196
212
|
}
|
|
197
213
|
}
|
|
198
214
|
|
|
215
|
+
endFetch()
|
|
199
216
|
return {frames: newFrames, windowStart: wStart, windowEnd: wEnd}
|
|
200
217
|
}
|
|
201
218
|
|
|
@@ -262,6 +279,7 @@ export class ReverseCursorVisualSampler extends BaseVisualSampler {
|
|
|
262
279
|
if (prefetched)
|
|
263
280
|
for (const f of prefetched.frames) f.close()
|
|
264
281
|
|
|
282
|
+
await idle
|
|
265
283
|
clear()
|
|
266
284
|
input?.dispose()
|
|
267
285
|
input = null
|