@stream-io/video-filters-web 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs.js +7 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +7 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/webgl2/resizingStage.d.ts +1 -1
- package/dist/src/webgl2/webgl2Pipeline.d.ts +1 -1
- package/package.json +1 -1
- package/src/helpers/webglHelper.ts +3 -1
- package/src/webgl2/resizingStage.ts +4 -1
- package/src/webgl2/webgl2Pipeline.ts +2 -0
package/dist/index.es.js
CHANGED
|
@@ -84,6 +84,8 @@ async function readPixelsAsync(gl, x, y, width, height, format, type, dest) {
|
|
|
84
84
|
async function getBufferSubDataAsync(gl, target, buffer, srcByteOffset, dstBuffer, dstOffset, length) {
|
|
85
85
|
const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
86
86
|
gl.flush();
|
|
87
|
+
if (!sync)
|
|
88
|
+
return;
|
|
87
89
|
const res = await clientWaitAsync(gl, sync);
|
|
88
90
|
gl.deleteSync(sync);
|
|
89
91
|
if (res !== gl.WAIT_FAILED) {
|
|
@@ -570,7 +572,7 @@ function buildJointBilateralFilterStage(gl, vertexShader, positionBuffer, texCoo
|
|
|
570
572
|
return { render, updateSigmaSpace, updateSigmaColor, cleanUp };
|
|
571
573
|
}
|
|
572
574
|
|
|
573
|
-
function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tflite, segmentationConfig) {
|
|
575
|
+
function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tflite, segmentationConfig, onError) {
|
|
574
576
|
const fragmentShaderSource = glsl `#version 300 es
|
|
575
577
|
|
|
576
578
|
precision highp float;
|
|
@@ -604,7 +606,8 @@ function buildResizingStage(gl, vertexShader, positionBuffer, texCoordBuffer, tf
|
|
|
604
606
|
// Downloads pixels asynchronously from GPU while rendering the current frame.
|
|
605
607
|
// The pixels will be available in the next frame render which results
|
|
606
608
|
// in offsets in the segmentation output but increases the frame rate.
|
|
607
|
-
readPixelsAsync(gl, 0, 0, outputWidth, outputHeight, gl.RGBA, gl.UNSIGNED_BYTE, outputPixels)
|
|
609
|
+
readPixelsAsync(gl, 0, 0, outputWidth, outputHeight, gl.RGBA, gl.UNSIGNED_BYTE, outputPixels).catch((error) => {
|
|
610
|
+
});
|
|
608
611
|
for (let i = 0; i < outputPixelCount; i++) {
|
|
609
612
|
const tfliteIndex = tfliteInputMemoryOffset + i * 3;
|
|
610
613
|
const outputIndex = i * 4;
|
|
@@ -669,7 +672,7 @@ function buildSoftmaxStage(gl, vertexShader, positionBuffer, texCoordBuffer, tfl
|
|
|
669
672
|
return { render, cleanUp };
|
|
670
673
|
}
|
|
671
674
|
|
|
672
|
-
function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, backgroundFilter, canvas, tflite, segmentationConfig) {
|
|
675
|
+
function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, backgroundFilter, canvas, tflite, segmentationConfig, onError) {
|
|
673
676
|
const gl = canvas.getContext('webgl2');
|
|
674
677
|
if (!gl)
|
|
675
678
|
throw new Error('WebGL2 is not supported');
|
|
@@ -1536,7 +1539,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1536
1539
|
return __Module.ready;
|
|
1537
1540
|
};
|
|
1538
1541
|
|
|
1539
|
-
const version = "0.1.
|
|
1542
|
+
const version = "0.1.6";
|
|
1540
1543
|
const packageName = "@stream-io/video-filters-web";
|
|
1541
1544
|
|
|
1542
1545
|
// @ts-expect-error - module is not declared
|