Skip to content

WebRTC: Support WebRTC, for video meeting, SFU server, video converence. #307

@winlinvip

Description

@winlinvip
Member

WebRTC is now quite mature, with stable playback and the protocol already being an RFC. There are also quite a few corresponding open-source projects. However, I believe that WebRTC still lacks a high-performance, simple and easy-to-use server. I have analyzed the existing servers before and found various issues. SRS has a great opportunity to solve these problems.

See English or Chinese

Activity

added this to the srs 3.0 release milestone on May 16, 2015
Jianru-Lin

Jianru-Lin commented on May 29, 2015

@Jianru-Lin
PengZheng

PengZheng commented on Sep 11, 2016

@PengZheng
823639792

823639792 commented on Sep 22, 2017

@823639792
changed the title [-]支持WebRTC[/-] [+]Support WebRTC[/+] on Dec 7, 2019
winlinvip

winlinvip commented on Jan 19, 2020

@winlinvip
Author
added a commit that references this issue on Jan 19, 2020
winlinvip

winlinvip commented on Mar 14, 2020

@winlinvip
Author
winlinvip

winlinvip commented on Mar 14, 2020

@winlinvip
MemberAuthor

candidate is the address that RTC provides services to the outside. In certain deployment scenarios, we need to configure it in multiple ways.

This is also the only item that RTC must confirm the configuration for, while others can be left at their default settings.

For detailed configuration instructions, please refer to: https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate

TRANS_BY_GPT3

added a commit that references this issue on Mar 14, 2020

54 remaining items

added 2 commits that reference this issue on Apr 3, 2020
winlinvip

winlinvip commented on Apr 4, 2020

@winlinvip
MemberAuthor

MacPro information:

  • macOS Mojave
  • Version 10.14.6 (18G3020)
  • MacBook Pro (Retina, 15-inch, Mid 2015)
  • Processor: 2.2 GHz Intel Core i7
  • Memory: 16 GB 1600 MHz DDR3

Docker information:

  • Docker Desktop 2.2.0.3(42716)
  • Engine: 19.03.5
  • Resources: CPUs 4, Memory 2GB, Swap 1GB

Note: SRS is bound to CPU0, Benchmark is bound to CPU2-3.

Note: The test video is still ./doc/source.200kbps.768x320.flv.

Note: The following tests are all Streams=1, meaning pushing one stream for multiple playback scenarios.

Baseline

Baseline without any optimization, the data is as follows:

Stage SRS Players CPU us sys si Docker
Baseline 4.0.20 200 51% 35% 19% 15% 233%

image

SRTP-NASM

SRTP enabled openssl, and openssl enabled assembly, which means that SRTP encryption and decryption are optimized with assembly. Refer to 5e06a256. The data is as follows:

Stage SRS Players CPU us sys si Docker
SRTP-NASM 4.0.20 200 38% 28% 22% 14% 198%
Baseline 4.0.20 200 51% 35% 19% 15% 233%

image

UDP sendmmsg + mw_latency

After enabling sendmmsg, multiple UDP packets can be sent at once. The data is as follows:

Remark: By default, RTC is configured for low latency, which means min_latency on; and play.mw_latency 0;, so the number of messages that can be written with each sendmmsg is not much. We will increase the latency to observe changes in performance.

Note: The queue (ms) below refers to mw_sleep, which is also known as mw_latency, which represents how many milliseconds the server actively queues (delays) before writing multiple packets at once.

Stage SRS Players Queue CPU us sys si Docker
--- --- --- --- --- --- --- --- ---
UDP sendmmsg 4.0.20 200 350ms 20% 22% 12% 4% 130%
UDP sendmmsg 4.0.20 200 200ms 18% 11% 7% 3% 132%
UDP sendmmsg 4.0.20 200 100ms 21% 18% 12% 5% 134%
UDP sendmmsg 4.0.20 200 0ms 38% 29% 20% 12% 200%
SRTP-NASM 4.0.20 200 0ms 38% 28% 22% 14% 198%
Baseline 4.0.20 200 0ms 51% 35% 19% 15% 233%

image

image

image

image

Although the optimization of queues over 100ms may not be significant, I think there may be other bottlenecks. From the data above, it can be seen that sendmmsg is very useful for optimizing system performance.

Currently, the server queue is set by increasing the delay, also known as mw_latency. This allows the server to send more data at once, which is useful for TCP optimization. However, for UDP, especially in low-latency RTC scenarios, it is not advisable to increase the delay to improve performance. In fact, sendmmsg allows for sending data to multiple clients at once, and future optimization will be aimed in this direction.

TRANS_BY_GPT3

added 3 commits that reference this issue on Apr 5, 2020

92 remaining items

mud0107

mud0107 commented on Jan 27, 2021

@mud0107
matishsiao

matishsiao commented on Mar 31, 2021

@matishsiao
linked a pull request that will close this issueSupport transmux RTC to RTMP. 4.0.95 #2303on Apr 27, 2021
locked as too heated and limited conversation to collaborators on Apr 28, 2021
pinned this issue on May 16, 2021
changed the title [-]Support WebRTC[/-] [+]Support WebRTC,一对一通话,多人通话,SFU,直播连麦,会议录制等[/+] on May 16, 2021
changed the title [-]Support WebRTC,一对一通话,多人通话,SFU,直播连麦,会议录制等[/-] [+]WebRTC: Support WebRTC, for video meeting, SFU server, video converence. 一对一通话,多人通话,SFU,直播连麦,会议录制等[/+] on Nov 25, 2022
changed the title [-]WebRTC: Support WebRTC, for video meeting, SFU server, video converence. 一对一通话,多人通话,SFU,直播连麦,会议录制等[/-] [+]WebRTC: Support WebRTC, for video meeting, SFU server, video converence.[/+] on Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FeatureIt's a new feature.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @yf-hk@johnlanz@Jianru-Lin@winlinvip@matishsiao

    Issue actions

      WebRTC: Support WebRTC, for video meeting, SFU server, video converence. · Issue #307 · ossrs/srs