ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
24.75k stars 5.28k forks source link

WebRTC: When multiple candidates, WHEP playback experience lag. #3861

Open winlinvip opened 8 months ago

winlinvip commented 8 months ago

Describe the bug When two candidates are returned, one of them is unreachable, and there is a stuttering issue when playing WHEP.

Version 6.0.96

To Reproduce Steps to reproduce the behavior:

  1. Start SRS Stack with Docker and set CANDIDATE to the private IP.
  2. When playing WHEP, add ?eip=127.0.0.1 to the URL.
  3. SRS will return two candidate addresses: one private IP and one 127.0.0.1.
  4. You will notice that WHEP playback is stuttering, and this issue consistently occurs.

Expected behavior Smooth playback without any stuttering issues.

Screenshots

Two candidates, WHEP stuttering:

https://github.com/ossrs/srs/assets/2777660/efe59330-a4fe-475c-85e5-cd48234c895e

One candidate, WHEP without stuttering:

https://github.com/ossrs/srs/assets/2777660/b6cb145a-0f08-4ecc-9b42-423e09a48646

winlinvip commented 3 months ago

WebRTC PeerConnection may switch between multiple candidates, which are used to establish UDP connections for data transport. This may cause the stuttering or pausing of video, leading to a discomfort experience.