Skip to content

Commit c74fae8

Browse files
committed
fix: preserve accurate decoding on software GPUs
1 parent 61e5110 commit c74fae8

1 file changed

Lines changed: 0 additions & 31 deletions

File tree

‎packages/editor-solid-web/src/browser-decoded-video-pool.ts‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ type DecodedSlot = {
2121
current: VideoSample | null;
2222
upcoming: VideoSample | null;
2323
lastRequestedTime: number;
24-
streamSamples: number;
25-
slowStreamSamples: number;
2624
serial: Promise<void>;
2725
};
2826

@@ -67,8 +65,6 @@ async function resetStream(slot: DecodedSlot) {
6765
slot.upcoming?.close();
6866
slot.upcoming = null;
6967
slot.lastRequestedTime = -1;
70-
slot.streamSamples = 0;
71-
slot.slowStreamSamples = 0;
7268
if (iterator) await iterator.return();
7369
}
7470

@@ -112,7 +108,6 @@ async function sampleAtTime(
112108

113109
export class BrowserDecodedVideoPool {
114110
private readonly slots = new Map<string, SlotEntry>();
115-
private readonly slowSources = new Set<string>();
116111
private retainedKeys: Set<string> | null = null;
117112
private disposed = false;
118113

@@ -155,8 +150,6 @@ export class BrowserDecodedVideoPool {
155150
current: null,
156151
upcoming: null,
157152
lastRequestedTime: -1,
158-
streamSamples: 0,
159-
slowStreamSamples: 0,
160153
serial: Promise.resolve(),
161154
retagBt601:
162155
config.codec.startsWith("avc1") &&
@@ -212,7 +205,6 @@ export class BrowserDecodedVideoPool {
212205
) {
213206
throw new Error("Editor video source URL is invalid");
214207
}
215-
if (this.slowSources.has(url.href)) return "fallback";
216208
const key = slotKey(segmentIndex, track, role);
217209
let entry = this.slots.get(key);
218210
if (entry && entry.url !== url.href) {
@@ -243,13 +235,11 @@ export class BrowserDecodedVideoPool {
243235
releaseSerial = resolve;
244236
});
245237
let sample: VideoSample | null;
246-
let decodeStarted = 0;
247238
try {
248239
await previous;
249240
if (signal.aborted || this.disposed) {
250241
throw signal.reason ?? new DOMException("Canceled", "AbortError");
251242
}
252-
decodeStarted = performance.now();
253243
sample = await sampleAtTime(slot, sourceTime, stream);
254244
} finally {
255245
releaseSerial();
@@ -321,17 +311,6 @@ export class BrowserDecodedVideoPool {
321311
bitmap.close();
322312
throw signal.reason ?? new DOMException("Canceled", "AbortError");
323313
}
324-
if (stream) {
325-
const elapsedMs = performance.now() - decodeStarted;
326-
if (slot.streamSamples === 0 && elapsedMs > 250) {
327-
this.retireSource(url.href);
328-
} else if (slot.streamSamples > 0) {
329-
slot.slowStreamSamples =
330-
elapsedMs > 100 ? slot.slowStreamSamples + 1 : 0;
331-
if (slot.slowStreamSamples >= 2) this.retireSource(url.href);
332-
}
333-
slot.streamSamples++;
334-
}
335314
return {
336315
bitmap,
337316
width: bitmap.width,
@@ -369,15 +348,6 @@ export class BrowserDecodedVideoPool {
369348
}
370349
}
371350

372-
private retireSource(url: string) {
373-
this.slowSources.add(url);
374-
for (const [key, entry] of this.slots) {
375-
if (entry.url !== url) continue;
376-
this.slots.delete(key);
377-
releaseEntry(entry);
378-
}
379-
}
380-
381351
retainSegments(primary: number, overlap: number | null) {
382352
const wanted = new Set<string>();
383353
for (const track of ["display", "camera"] as const) {
@@ -406,7 +376,6 @@ export class BrowserDecodedVideoPool {
406376
this.disposed = true;
407377
for (const entry of this.slots.values()) releaseEntry(entry);
408378
this.slots.clear();
409-
this.slowSources.clear();
410379
this.retainedKeys = null;
411380
}
412381
}

0 commit comments

Comments
 (0)