Doreapp
Doreapp

Reputation: 166

Is there a way to reduce latency using getUserMedia?

While trying to reduce the video latency for a WebRTC communication, I measured the delay between the video capture and the video display.

To prevent measuring latency involved by WebRTC, I just used getUserMedia and an HTML video that displayed the stream.

I did it by displaying a timestamp every frame (using requestAnimationFrame), recording my screen with a USB camera and taking screenshots where both the video display and the displayed timestamp where visible.

On average, I measured a delay of ~150ms. This must be an overestimation (due to requestAnimationFrame time between calls), however the minimum measure I made is around 120ms, that still a lot.

Now, is there a way to reduce this delay between the video capture and the video display ?


Note:

Upvotes: 2

Views: 1461

Answers (1)

Philipp Hancke
Philipp Hancke

Reputation: 17305

In general this is something you can only fix in the browser itself.

The requestVideoFrameCallback API is gathering some numbers such as captureTime and renderTime. https://web.dev/requestvideoframecallback-rvfc/ has a pretty good description, https://webrtc.github.io/samples/src/content/peerconnection/per-frame-callback/ visualizes them.

Upvotes: 2

Related Questions