getUserMedia() taking a long time to return stream

657 views
Skip to first unread message

Zach Servies

unread,
Sep 4, 2023, 3:09:20 AM9/4/23
to discuss-webrtc
Hey all,

I'm not sure if its been noticed, but for awhile now getUserMedia() has been taking a consistent 4-10 seconds to return media when spinning up video. I'm part of a team that builds a video product using WebRTC and have had quite a few customer complaints about it taking a long time for the app to turn on their webcam. Typically the first time you spin it up, it will take 4-6 seconds to return a media stream. Subsequent muting/requests tend to be much quicker but if you turn your video off for 15-30 seconds then try to turn it back on, it'll take that initial 4-6 seconds again. The issue is also exasperated by heavy computer loads, so if you're doing intensive things it can take as long as 30-60 seconds for getUserMedia() to return a media stream.

At first we thought this was our issue, but after some analysis and doing some testing we've come to believe this may be an issue with Chrome. The issue can be reproduced in Google Hangout and the WebRTC sample demo when using Chrome. The issue seemingly goes away when switching to a different browser such as Safari or Firefox. In those browsers, getUserMedia() is near instant at returning a media stream.

Philipp Hancke

unread,
Sep 4, 2023, 4:32:19 AM9/4/23
to discuss...@googlegroups.com
That sounds like a driver issue. Is this on Windows by chance (even though using Safari does not sound like it)?
If yes, does it get better if you (or the affected users) disable MediaFoundation capture via
  chrome://flags/#enable-media-foundation-video-capture
If the answer is still yes could you please file a bug over at crbug.com/new with the Blink>GetUserMedia component and attach a screenshot of the video-capture pane of chrome://media-internals that shows the device name.

--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/c0bd7802-1714-4ef9-a82d-15d5600ba88bn%40googlegroups.com.

Zach Servies

unread,
Sep 6, 2023, 1:57:49 AM9/6/23
to discuss-webrtc
This is on both Windows and MacOS.

Tony Herre

unread,
Sep 6, 2023, 5:09:43 AM9/6/23
to discuss-webrtc
We have some stats reported in Chrome for getUserMedia latency which don't show any dramatic increases over the last six months. Maybe a slight upward trend of 300ms at the 95th percentile since July on Mac and Windows (google internal link: http://shortn/_PTcbtcSGx1). Definitely more than I'd like taking over 5s (like 1-2% across the board).
Would be great to understand the scenarios where we get such long latencies, so please do file a bug like Philipp said, thanks!
Reply all
Reply to author
Forward
0 new messages