Skip to content

Commit

Permalink
follow up on rgbx issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Aug 17, 2024
1 parent 61b5051 commit e94df10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ async function capture() {
const W = videoFrame.codedWidth
const H = videoFrame.codedHeight
const rgbx = new Uint8ClampedArray(H * W * 4)
for (let i = 3; i < rgbx.length; i += 4)
rgbx[i] = 255

if (effect.value != 'pose_landmarks') {
let yuv_data = []
if (effect.value.includes('sorting') || effect.value.includes('dithering')) {
Expand Down Expand Up @@ -500,10 +499,13 @@ async function capture() {
timestamp: videoFrame.timestamp,
}
videoFrame.close()
if (rgbx[3] == 0) // Circumvent Chrome issue where alpha is not being ignored: https://issues.chromium.org/issues/360354555
for (let i = 3; i < rgbx.length; i += 4)
rgbx[i] = 255
controller.enqueue(new VideoFrame(rgbx, init))
}
})
const transformed = trackProcessor.readable.pipeThrough(transformer).pipeTo(trackGenerator.writable)
trackProcessor.readable.pipeThrough(transformer).pipeTo(trackGenerator.writable)
out_video.srcObject = new MediaStream([trackGenerator])
}

Expand Down

0 comments on commit e94df10

Please sign in to comment.