I am drawing video frame on html5 canvas in Chrome. The VideoFrame comes from the VideoDecoder which is the API for web codec in the browser. Immediately after drawing the videoFrame on the canvas I close it with the close()
method. Use of close()
is important to release resources. Unfortunately, in chrome sometimes the video flickers. It seems that the draw image did not finish the rendering before I close it.
Code snippet:
this.renderingCtx.drawImage(frame, 0, 0, frame.codedWidth, frame.codedHeight,
0, 0, this.canvasElement.width, this.canvasElement.height);
frame.close();
How can I solve that?
I tried to delay the closing of the frame and it did improve the flicker problem but there are still flickering on the video.