@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/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.4";
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