peer-calls / peer-calls

Group peer to peer video calls for everyone written in Go and TypeScript
https://peercalls.com
Apache License 2.0
1.74k stars 284 forks source link

Really bad video/audio lag #282

Open prologic opened 1 year ago

prologic commented 1 year ago

Hey @jeremija I noticed in the last few releases that audio/video lag is now really bad.

Even on your public demo/test instance.

Simple test:

My own instance is using a mech network. I think yours is using sfu. I've tried both though, and even rebooted my TURN/STUN server. I'm not sure what's changed 😅

jeremija commented 1 year ago

That's really weird, nothing that I changed should have affected the latency as the changes were largely cosmetic. One thing that I did was updated is the pion/webrtc library to the latest version, but still it shouldn't have had affected the latency. And it is not used with network type set to mesh.

I was running some tests earlier today with different devices and I didn't notice any latencies. Is it possible that the issues you see are due to some kind of ISP throttling?

If not, would you be able to bisect - isolate a commit or version after which it had started happening?

prologic commented 1 year ago

I'd be very interested in helping get the bottom of this. I built peercalls locally too just to rule out any funny stuff going on with the Docker images you build and publish.

Are there any other ways in peercalls, tools or otherwise I can use to help debug / pin-point what is going on here?

jeremija commented 1 year ago

Thanks! When you're using the mesh network type, the browsers establish direct peer to peer connections when possible (or use a TURN relay when it isn't), so it's really out of our hands.

In either case (sfu or mesh), you should be able to monitor the details of webrtc connections within the browser (about:webrtc or about:webrtc-internals, you'll see some nice charts there) as described in this section.

It is more likely you'll experience delays when the connection is relayed, or when TCP is used (UDP is faster).

I'm not surprised that you experience delays with my server in SFU mode, since it's based in EU, and you seem to be in Australia.

jeremija commented 1 year ago

Oh, and the latest version v4.2.1 allows you to display some of the same stats over the video. There's a per-video and a global setting.

Screenshot_20230213-063324 Screenshot_20230213-063349

prologic commented 1 year ago

Nice! I'll do some digging and report back 👌 I really love Peer-Calls as its infinitely much simpler to operate 😆