Skip to content

Commit

Permalink
SquashSRS4: Support RTC2RTMP.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed May 1, 2021
1 parent 0b62216 commit 74bb47c
Show file tree
Hide file tree
Showing 22 changed files with 1,173 additions and 771 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ docker run --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 \
ossrs/srs:v4.0.85
```

> To enable WebRTC, user MUST set the env `CANDIDATE`, see [#307](https://github.com/ossrs/srs/issues/307#issue-76908382).
> To enable WebRTC, user MUST set the env `CANDIDATE`, see [wiki](https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate).
Open [http://localhost:8080/](http://localhost:8080/) to check it, then publish
[stream](https://github.com/ossrs/srs/blob/3.0release/trunk/doc/source.200kbps.768x320.flv) by:
[stream](https://github.com/ossrs/srs/blob/3.0release/trunk/doc/source.flv) by:

```bash
docker run --rm --network=host ossrs/srs:encoder ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
docker run --rm --network=host ossrs/srs:encoder ffmpeg -re -i ./doc/source.flv \
-c copy -f flv -y rtmp://localhost/live/livestream
```
> Note: If WebRTC enabled, you can publish by [H5](http://localhost:8080/players/rtc_publisher.html?autostart=true).
Expand Down Expand Up @@ -67,8 +67,7 @@ Fast index for Wikis:
* How to deliver HTTP-FLV streaming?([CN][v4_CN_SampleHttpFlv], [EN][v4_EN_SampleHttpFlv])
* How to deliver HLS streaming?([CN][v4_CN_SampleHLS], [EN][v4_EN_SampleHLS])
* How to deliver low-latency streaming?([CN][v4_CN_SampleRealtime], [EN][v4_EN_SampleRealtime])
* Usage: How to play WebRTC from SRS? [#307](https://github.com/ossrs/srs/issues/307)
* Usage: How to publish WebRTC to SRS? [#307](https://github.com/ossrs/srs/issues/307)
* How to use WebRTC? ([CN][v4_CN_WebRTC], [EN][v4_EN_WebRTC])

Other important wiki:

Expand Down Expand Up @@ -127,6 +126,7 @@ Other important wiki:
- [x] [Experimental] Support mux RTP/RTCP/DTLS/SRTP on one port for WebRTC, [#307][bug #307].
- [x] [Experimental] Support client address changing for WebRTC, [#307][bug #307].
- [x] [Experimental] Support transcode RTMP/AAC to WebRTC/Opus, [#307][bug #307].
- [x] [Experimental] Support AV1 codec for WebRTC, [#2324][bug #2324].
- [x] [Experimental] Enhance HTTP Stream Server for HTTP-FLV, HTTPS, HLS etc. [#1657][bug #1657].
- [x] [Experimental] Support push stream by GB28181, [#1500][bug #1500].
- [x] [Experimental] Support DVR in MP4 format, read [#738][bug #738].
Expand Down Expand Up @@ -163,7 +163,10 @@ Other important wiki:

## V4 changes

* v4.0, 2021-04-29, RTC: Support av1 for Chrome M90. 4.0.91
* v5.0, 2021-04-20, Support RTC2RTMP bridger and shared FastTimer. 4.0.95
* v5.0, 2021-04-20, Refine transcoder to support aac2opus and opus2aac. 4.0.94
* v4.0, 2021-05-01, Timer: Extract and apply shared FastTimer. 4.0.93
* v4.0, 2021-04-29, RTC: Support AV1 for Chrome M90. 4.0.91
* v4.0, 2021-04-24, Change push-RTSP as deprecated feature.
* v4.0, 2021-04-24, Player: Change the default from RTMP to HTTP-FLV.
* v4.0, 2021-04-24, Disable CherryPy by --cherrypy=off. 4.0.90
Expand Down Expand Up @@ -1263,8 +1266,8 @@ Maintainers of SRS project:
* [Winlin](https://github.com/winlinvip): All areas of streaming server and documents.
* [Wenjie](https://github.com/wenjiegit): The focus of his work is on the [HDS](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_DeliveryHDS) module.
* [Runner365](https://github.com/runner365): The focus of his work is on the [SRT](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_SRTWiki) module.
* [John](https://github.com/xiaozhihong): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_RTCWiki) module.
* [B.P.Y(Bepartofyou)](https://github.com/Bepartofyou): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_RTCWiki) module.
* [John](https://github.com/xiaozhihong): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
* [B.P.Y(Bepartofyou)](https://github.com/Bepartofyou): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_WebRTC) module.
* [Lixin](https://github.com/xialixin): Focus on [GB28181](https://github.com/ossrs/srs/issues/1500) module.

A big THANK YOU goes to:
Expand Down Expand Up @@ -1387,6 +1390,8 @@ Winlin
[v4_EN_SampleForward]: https://github.com/ossrs/srs/wiki/v4_EN_SampleForward
[v4_CN_SampleRealtime]: https://github.com/ossrs/srs/wiki/v4_CN_SampleRealtime
[v4_EN_SampleRealtime]: https://github.com/ossrs/srs/wiki/v4_EN_SampleRealtime
[v4_CN_WebRTC]: https://github.com/ossrs/srs/wiki/v4_CN_WebRTC
[v4_EN_WebRTC]: https://github.com/ossrs/srs/wiki/v4_EN_WebRTC
[v4_CN_SampleARM]: https://github.com/ossrs/srs/wiki/v4_CN_SampleARM
[v4_EN_SampleARM]: https://github.com/ossrs/srs/wiki/v4_EN_SampleARM
[v4_CN_SampleIngest]: https://github.com/ossrs/srs/wiki/v4_CN_SampleIngest
Expand Down Expand Up @@ -1817,7 +1822,6 @@ Winlin
[bug #1543]: https://github.com/ossrs/srs/issues/1543
[bug #1509]: https://github.com/ossrs/srs/issues/1509
[bug #1575]: https://github.com/ossrs/srs/issues/1575
[bug #307]: https://github.com/ossrs/srs/issues/307
[bug #1070]: https://github.com/ossrs/srs/issues/1070
[bug #1580]: https://github.com/ossrs/srs/issues/1580
[bug #1547]: https://github.com/ossrs/srs/issues/1547
Expand Down Expand Up @@ -1872,6 +1876,8 @@ Winlin
[bug #1998]: https://github.com/ossrs/srs/issues/1998
[bug #2106]: https://github.com/ossrs/srs/issues/2106
[bug #2011]: https://github.com/ossrs/srs/issues/2011
[bug #2324]: https://github.com/ossrs/srs/issues/2324
[bug #1500]: https://github.com/ossrs/srs/issues/1500
[bug #zzzzzzzzzzzzz]: https://github.com/ossrs/srs/issues/zzzzzzzzzzzzz

[exo #828]: https://github.com/google/ExoPlayer/pull/828
Expand Down
101 changes: 54 additions & 47 deletions trunk/conf/full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -446,52 +446,53 @@ srt_server {
rtc_server {
# Whether enable WebRTC server.
# default: off
enabled on;
enabled on;
# The udp listen port, we will reuse it for connections.
# default: 8000
listen 8000;
listen 8000;
# The exposed candidate IPs, response in SDP candidate line. It can be:
# * Retrieve server IP automatically, from all network interfaces.
# eth0 Retrieve server IP by specified network interface name. # TODO: Implements it.
# $CANDIDATE Read the IP from ENV variable, use * if not set, see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
# $CANDIDATE Read the IP from ENV variable, use * if not set.
# x.x.x.x A specified IP address or DNS name, which can be access by client such as Chrome.
# You can specific more than one interface name:
# eth0 eth1 Use network interface eth0 and eth1. # TODO: Implements it.
# Also by IP or DNS names:
# 192.168.1.3 10.1.2.3 rtc.me # TODO: Implements it.
# And by multiple ENV variables:
# $CANDIDATE $EIP # TODO: Implements it.
# @remark For Firefox, the candidate MUST be IP, MUST NOT be DNS name, see also https://github.com/ossrs/srs/pull/1998#issuecomment-726442999
# @remark For Firefox, the candidate MUST be IP, MUST NOT be DNS name.
# @see https://github.com/ossrs/srs/wiki/v4_CN_RTCWiki#config-candidate
# default: *
candidate *;
# The IP family filter for candidate, it can be:
candidate *;
# The IP family filter for auto discover candidate, it can be:
# ipv4 Filter IP v4 candidates.
# ipv6 Filter IP v6 candidates.
# all Filter all IP v4 or v6 candidates.
# For example, if set to ipv4, we only use the IPv4 address as candidate.
# default: ipv4
ip_family ipv4;
ip_family ipv4;
# Whether use ECDSA certificate.
# If not, use RSA certificate.
# default: on
ecdsa on;
ecdsa on;
# Whether encrypt RTP packet by SRTP.
# @remark Should always turn it on, or Chrome will fail.
# default: on
encrypt on;
encrypt on;
# We listen multiple times at the same port, by REUSEPORT, to increase the UDP queue.
# Note that you can set to 1 and increase the system UDP buffer size by net.core.rmem_max
# and net.core.rmem_default or just increase this to get larger UDP recv and send buffer.
# default: 1
reuseport 1;
reuseport 1;
# Whether merge multiple NALUs into one.
# @see https://github.com/ossrs/srs/issues/307#issuecomment-612806318
# default: off
merge_nalus off;
merge_nalus off;
# Whether enable the perf stat at http://localhost:1985/api/v1/perf
# TODO: FIXME: We should enable it when refined.
# default: off
perf_stat off;
perf_stat off;
# For RTP packet and its payload cache.
rtp_cache {
# Whether enable the RTP packet cache.
Expand Down Expand Up @@ -533,61 +534,67 @@ vhost rtc.vhost.srs.com {
rtc {
# Whether enable WebRTC server.
# default: off
enabled on;
# The strategy for bframe.
# keep Keep bframe, which may make browser with playing problems.
# discard Discard bframe, maybe cause browser with little problems.
# default: keep
bframe discard;
# The strategy for aac audio.
# transcode Transcode aac to opus.
# discard Discard aac audio packet.
# default: transcode
aac transcode;
enabled on;
# Whether support NACK.
# default: on
nack on;
# Whether directly use the packet, avoid copy.
# default: on
nack_no_copy on;
# Whether support TWCC.
# default: on
twcc on;
# The timeout in seconds for session timeout.
# Client will send ping(STUN binding request) to server, we use it as heartbeat.
# default: 30
stun_timeout 30;
# The strick check when process stun.
stun_timeout 30;
# The strict check when process stun.
# default: off
stun_strict_check on;
# The role of dtls when peer is actpass: passive or active
# default: passive
dtls_role passive;
dtls_role passive;
# The version of dtls, support dtls1.0, dtls1.2, and auto
# default: auto
dtls_version auto;
# Drop the packet with the pt(payload type), 0 never drop.
# default: 0
drop_for_pt 0;
###############################################################
# For transmuxing RTMP to RTC, the strategy for bframe.
# keep Keep bframe, which may make browser with playing problems.
# discard Discard bframe, maybe cause browser with little problems.
# default: discard
bframe discard;
# For transmuxing RTMP to RTC, the strategy for aac audio.
# transcode Transcode aac to opus.
# discard Discard aac audio packet.
# default: transcode
aac transcode;
###############################################################
# For transmuxing RTC to RTMP.
# Whether trans-mux RTC to RTMP streaming.
# Default: off
rtc_to_rtmp off;
# The PLI interval in seconds, for RTC to RTMP.
# Note the available range is [0.5, 30]
# Default: 6.0
pli_for_rtmp 6.0;
}
# whether enable min delay mode for vhost.
###############################################################
# For transmuxing RTMP to RTC, it will impact the default values if RTC is on.
# Whether enable min delay mode for vhost.
# default: on, for RTC.
min_latency on;
min_latency on;
play {
# set the MW(merged-write) latency in ms.
# @remark For WebRTC, we enable pass-timestamp mode, so we ignore this config.
# default: 0 (For WebRTC)
mw_latency 0;
mw_latency 0;
# Set the MW(merged-write) min messages.
# default: 0 (For Real-Time, min_latency on)
# default: 1 (For WebRTC, min_latency off)
mw_msgs 0;
}
# For NACK.
nack {
# Whether support NACK.
# default: on
enabled on;
# Whether directly use the packet, avoid copy.
# default: on
no_copy on;
}
# For TWCC.
twcc {
# Whether support TWCC.
# default: on
enabled on;
# default: 0 (For Real-Time, that is min_latency on)
# default: 1 (For WebRTC, that is min_latency off)
mw_msgs 0;
}
}

Expand Down
9 changes: 4 additions & 5 deletions trunk/conf/rtc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ stats {
network 0;
}
rtc_server {
enabled on;
enabled on;
# Listen at udp://8000
listen 8000;
listen 8000;
#
# The $CANDIDATE means fetch from env, if not configed, use * as default.
#
# The * means retrieving server IP automatically, from all network interfaces,
# @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
candidate $CANDIDATE;
# @see https://github.com/ossrs/srs/wiki/v4_CN_RTCWiki#config-candidate
candidate $CANDIDATE;
}

vhost __defaultVhost__ {
rtc {
enabled on;
bframe discard;
}
http_remux {
enabled on;
Expand Down
42 changes: 42 additions & 0 deletions trunk/conf/rtc2rtmp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;

http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}

http_api {
enabled on;
listen 1985;
}
stats {
network 0;
}
rtc_server {
enabled on;
# Listen at udp://8000
listen 8000;
#
# The $CANDIDATE means fetch from env, if not configed, use * as default.
#
# The * means retrieving server IP automatically, from all network interfaces,
# @see https://github.com/ossrs/srs/wiki/v4_CN_RTCWiki#config-candidate
candidate $CANDIDATE;
}

vhost __defaultVhost__ {
rtc {
enabled on;
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}

47 changes: 0 additions & 47 deletions trunk/conf/rtc_live.conf

This file was deleted.

1 change: 1 addition & 0 deletions trunk/doc/source.flv
Loading

0 comments on commit 74bb47c

Please sign in to comment.