From 0ceff436b01bd36258b9b721d10cdfe349917951 Mon Sep 17 00:00:00 2001 From: Ivan Liang Date: Tue, 16 Jan 2024 12:45:56 -0500 Subject: [PATCH] Don't getCameraImagePixels on detached/0len buffer --- src/systems/armarker/camera-capture/ccarheadset.js | 3 +++ src/systems/armarker/camera-capture/ccwebar.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/systems/armarker/camera-capture/ccarheadset.js b/src/systems/armarker/camera-capture/ccarheadset.js index 61ad28e2c..c9c83342f 100644 --- a/src/systems/armarker/camera-capture/ccarheadset.js +++ b/src/systems/armarker/camera-capture/ccarheadset.js @@ -190,6 +190,9 @@ export default class ARHeadsetCameraCapture { * @private */ async getCameraImagePixels(time) { + if (this.frameGsPixels.length === 0) { + return; + } let imageData; try { this.canvasCtx.drawImage(this.video, 0, 0, this.frameWidth, this.frameHeight); diff --git a/src/systems/armarker/camera-capture/ccwebar.js b/src/systems/armarker/camera-capture/ccwebar.js index e07219a84..2082d7d39 100644 --- a/src/systems/armarker/camera-capture/ccwebar.js +++ b/src/systems/armarker/camera-capture/ccwebar.js @@ -166,6 +166,9 @@ export default class WebARCameraCapture { * @private */ async getCameraImagePixels(time) { + if (this.frameGsPixels.length === 0) { + return; + } let imageData; try { this.canvasCtx.drawImage(this.video, 0, 0, this.frameWidth, this.frameHeight);