Skip to content

Commit

Permalink
Don't getCameraImagePixels on detached/0len buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-liang committed Jan 16, 2024
1 parent 48deb91 commit 0ceff43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/systems/armarker/camera-capture/ccarheadset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/systems/armarker/camera-capture/ccwebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0ceff43

Please sign in to comment.