|
|
@ -90,7 +90,9 @@ function canRecord(cb) {
|
|
|
|
|
|
|
|
|
|
|
|
if (_config.numOfWorkers > 0) {
|
|
|
|
if (_config.numOfWorkers > 0) {
|
|
|
|
initWorkers(function() {
|
|
|
|
initWorkers(function() {
|
|
|
|
|
|
|
|
if (ENV.development) {
|
|
|
|
console.log("Workers created");
|
|
|
|
console.log("Workers created");
|
|
|
|
|
|
|
|
}
|
|
|
|
ready(cb);
|
|
|
|
ready(cb);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -148,7 +150,9 @@ function initBuffers(imageWrapper) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ENV.development) {
|
|
|
|
console.log(_inputImageWrapper.size);
|
|
|
|
console.log(_inputImageWrapper.size);
|
|
|
|
|
|
|
|
}
|
|
|
|
_boxSize = [
|
|
|
|
_boxSize = [
|
|
|
|
vec2.clone([0, 0]),
|
|
|
|
vec2.clone([0, 0]),
|
|
|
|
vec2.clone([0, _inputImageWrapper.size.y]),
|
|
|
|
vec2.clone([0, _inputImageWrapper.size.y]),
|
|
|
@ -341,15 +345,19 @@ function initWorker(cb) {
|
|
|
|
URL.revokeObjectURL(blobURL);
|
|
|
|
URL.revokeObjectURL(blobURL);
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
|
|
|
|
if (ENV.development) {
|
|
|
|
console.log("Worker initialized");
|
|
|
|
console.log("Worker initialized");
|
|
|
|
|
|
|
|
}
|
|
|
|
return cb(workerThread);
|
|
|
|
return cb(workerThread);
|
|
|
|
} else if (e.data.event === 'processed') {
|
|
|
|
} else if (e.data.event === 'processed') {
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.busy = false;
|
|
|
|
publishResult(e.data.result, workerThread.imageData);
|
|
|
|
publishResult(e.data.result, workerThread.imageData);
|
|
|
|
} else if (e.data.event === 'error') {
|
|
|
|
} else if (e.data.event === 'error') {
|
|
|
|
|
|
|
|
if (ENV.development) {
|
|
|
|
console.log("Worker error: " + e.data.message);
|
|
|
|
console.log("Worker error: " + e.data.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
workerThread.worker.postMessage({
|
|
|
|
workerThread.worker.postMessage({
|
|
|
@ -449,7 +457,9 @@ export default {
|
|
|
|
_stopped = true;
|
|
|
|
_stopped = true;
|
|
|
|
_workerPool.forEach(function(workerThread) {
|
|
|
|
_workerPool.forEach(function(workerThread) {
|
|
|
|
workerThread.worker.terminate();
|
|
|
|
workerThread.worker.terminate();
|
|
|
|
|
|
|
|
if (ENV.development) {
|
|
|
|
console.log("Worker terminated!");
|
|
|
|
console.log("Worker terminated!");
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
_workerPool.length = 0;
|
|
|
|
_workerPool.length = 0;
|
|
|
|
if (_config.inputStream.type === "LiveStream") {
|
|
|
|
if (_config.inputStream.type === "LiveStream") {
|
|
|
@ -489,7 +499,7 @@ export default {
|
|
|
|
size: 800,
|
|
|
|
size: 800,
|
|
|
|
src: config.src
|
|
|
|
src: config.src
|
|
|
|
},
|
|
|
|
},
|
|
|
|
numOfWorkers: ENV.development ? 0 : 1,
|
|
|
|
numOfWorkers: (ENV.development && config.debug) ? 0 : 1,
|
|
|
|
locator: {
|
|
|
|
locator: {
|
|
|
|
halfSample: false
|
|
|
|
halfSample: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|