ossrs / srs

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

RTC2RTMP: Fix screen sharing stutter caused by packet loss. v5.0.216 v6.0.157 v7.0.18 #4160

Closed suzp1984 closed 1 month ago

suzp1984 commented 3 months ago

How to reproduce?

  1. Refer this commit, which contains the web demo to capture screen as video stream through RTC.
  2. Copy the trunk/research/players/whip.html and trunk/research/players/js/srs.sdk.js to replace the develop branch source code.
  3. ./configure && make
  4. ./objs/srs -c conf/rtc2rtmp.conf
  5. open http://localhost:8080/players/whip.html?schema=http
  6. check Screen radio option.
  7. click publish, then check the screen to share.
  8. play the rtmp live stream: rtmp://localhost/live/livestream
  9. check the video stuttering.

Cause

When capture screen by the chrome web browser, which send RTP packet with empty payload frequently, then all the cached RTP packets are dropped before next key frame arrive in this case.

The OBS screen stream and camera stream do not have such problem.

Add screen stream to WHIP demo

Screenshot 2024-08-28 at 2 49 46 PM