diff --git a/QtQrDec/Qrimagedecoder.cpp b/QtQrDec/Qrimagedecoder.cpp index 868d42c..0e804a2 100644 --- a/QtQrDec/Qrimagedecoder.cpp +++ b/QtQrDec/Qrimagedecoder.cpp @@ -41,16 +41,14 @@ EM_JS(void, js_start, (), { let canvas = document.querySelector("#qrcanvas"); let ctx=canvas.getContext("2d"); const processFrame = function () { - //You need to define qtQR module when loading the module of the qt application. + //You need to define qtQR module when loading the module of the qt application. ctx.drawImage(video, 0, 0, canvas.width, canvas.height); const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const sourceBuffer = imageData.data; - if (qtQR.module() != null) { - const buffer = qtQR.module()._malloc(sourceBuffer.byteLength); - qtQR.module().HEAPU8.set(sourceBuffer, buffer); - qtQR.module().QRImageDecoder.getdecoder().reload(buffer,video.width,video.height); - qtQR.module()._free(buffer); - } + const buffer = qtQR._malloc(sourceBuffer.byteLength); + qtQR.HEAPU8.set(sourceBuffer, buffer); + qtQR.QRImageDecoder.getdecoder().reload(buffer,video.width,video.height); + qtQR._free(buffer); if(window.localStream.active) { requestAnimationFrame(processFrame);