webrtc – InsertableStreams take a already modified videoFrame input

Let’s say we have :

const trackProcessor = new MediaStreamTrackProcessor({track: tracks})
const trackGenerator = new MediaStreamTrackGenerator({kind: 'video'})

const transformer = new TransformStream({
   async transform(videoFrame, controller) {
      ... some frame tranformation
      videoFrame.close()
      controller.enqueue(newFrame)
  }
})

trackProcessor.readable.pipeThrough(transformer).pipeTo(trackGenerator.writable)

In this example our n+1 videoFrame take the current newFrame ? Then apply the same tranformation on the already tranformed frame…

For example, if the tranformation is a blur, the blur will be applied multiple times (every time transformer is call.

How to deal with this if you want to apply one time a blur ?

Read more here: Source link