Internal change

PiperOrigin-RevId: 490595529
This commit is contained in:
MediaPipe Team 2022-11-23 15:23:02 -08:00 committed by Copybara-Service
parent bfa57310c4
commit 41a7f9d7d6

View File

@ -176,10 +176,14 @@ export class GraphRunner {
if (glCanvas !== undefined) {
this.wasmModule.canvas = glCanvas;
} else {
} else if (typeof OffscreenCanvas !== 'undefined') {
// If no canvas is provided, assume Chrome/Firefox and just make an
// OffscreenCanvas for GPU processing.
this.wasmModule.canvas = new OffscreenCanvas(1, 1);
} else {
console.warn('OffscreenCanvas not detected and GraphRunner constructor '
+ 'glCanvas parameter is undefined. Creating backup canvas.');
this.wasmModule.canvas = document.createElement('canvas');
}
}