Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WebRTC: Support transport over TCP directly, not TURN. #3166

Merged
merged 4 commits into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions trunk/conf/full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ auto_reload_for_docker on;
# the rtmp listen ports, split by space, each listen entry is <[ip:]port>
# for example, 192.168.1.100:1935 10.10.10.100:1935
# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
# Overwrite by env SRS_LISTEN
listen 1935;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
Expand All @@ -135,12 +136,14 @@ chunk_size 60000;
# where the cli can only be used in shell/terminate.
http_api {
# whether http api is enabled.
# Overwrite by env SRS_HTTP_API_ENABLED
# default: off
enabled on;
# The http api listen entry is <[ip:]port>, For example, 192.168.1.100:8080, where the ip is optional, default to
# 0.0.0.0, that is 8080 equals to 0.0.0.0:8080.
# Note that you're able to use a dedicated port for HTTP API, such as 1985, to be different with HTTP server. In
# this situation, you you must also set another HTTPS API port.
# Overwrite by env SRS_HTTP_API_LISTEN
# Default: 1985
listen 8080;
# whether enable crossdomain request.
Expand All @@ -164,11 +167,13 @@ http_api {
# For https_api or HTTPS API.
https {
# Whether enable HTTPS API.
# Overwrite by env SRS_HTTP_API_HTTPS_ENABLED
# default: off
enabled on;
# The listen endpoint for HTTPS API.
# Note that you're able to use a dedicated port for HTTPS API, such as 1990, and the HTTP API should not be
# the same of HTTP server(8080) neither.
# Overwrite by env SRS_HTTP_API_HTTPS_LISTEN
# Default: 1990
listen 8088;
# The SSL private key file, generated by:
Expand All @@ -193,12 +198,14 @@ http_api {
# need to open the feature http of vhost.
http_server {
# whether http streaming service is enabled.
# Overwrite by env SRS_HTTP_SERVER_ENABLED
# default: off
enabled on;
# the http streaming listen entry is <[ip:]port>
# for example, 192.168.1.100:8080
# where the ip is optional, default to 0.0.0.0, that is 8080 equals to 0.0.0.0:8080
# @remark, if use lower port, for instance 80, user must start srs by root.
# Overwrite by env SRS_HTTP_SERVER_LISTEN
# default: 8080
listen 8080;
# the default dir for http root.
Expand All @@ -211,9 +218,11 @@ http_server {
# For https_server or HTTPS Streaming.
https {
# Whether enable HTTPS Streaming.
# Overwrite by env SRS_HTTP_SERVER_HTTTPS_ENABLED
# default: off
enabled on;
# The listen endpoint for HTTPS Streaming.
# Overwrite by env SRS_HTTP_SERVER_HTTTPS_LISTEN
# default: 8088
listen 8088;
# The SSL private key file, generated by:
Expand Down Expand Up @@ -297,43 +306,72 @@ vhost srt.vhost.srs.com {
#############################################################################################
rtc_server {
# Whether enable WebRTC server.
# Overwrite by env SRS_RTC_SERVER_ENABLED
# default: off
enabled on;
# The udp listen port, we will reuse it for connections.
# Overwrite by env SRS_RTC_SERVER_LISTEN
# default: 8000
listen 8000;
# For WebRTC over TCP directly, not TURN, see https://github.com/ossrs/srs/issues/2852
# Some network does not support UDP, or not very well, so we use TCP like HTTP/80 port for firewall traversing.
tcp {
# Whether enable WebRTC over TCP.
# Overwrite by env SRS_RTC_SERVER_TCP_ENABLED
# Default: off
enabled off;
# The TCP listen port for WebRTC. Highly recommend is some normally used ports, such as TCP/80, TCP/443,
# TCP/8000, TCP/8080 etc. However SRS default to TCP/8000 corresponding to UDP/8000.
# Overwrite by env SRS_RTC_SERVER_TCP_LISTEN
# Default: 8000
listen 8000;
}
# The protocol for candidate to use, it can be:
# udp Generate UDP candidates. Note that UDP server is always enabled for WebRTC.
# tcp Generate TCP candidates. Fail if rtc_server.tcp(WebRTC over TCP) is disabled.
# all Generate UDP+TCP candidates. Ignore if rtc_server.tcp(WebRTC over TCP) is disabled.
# Note that if both are connected, we will use the first connected(DTLS done) one.
# Overwrite by env SRS_RTC_SERVER_PROTOCOL
# Default: udp
protocol udp;
# The exposed candidate IPs, response in SDP candidate line. It can be:
# * Retrieve server IP automatically, from all network interfaces.
# $CANDIDATE Read the IP from ENV variable, use * if not set.
# x.x.x.x A specified IP address or DNS name, use * if 0.0.0.0.
# @remark For Firefox, the candidate MUST be IP, MUST NOT be DNS name, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
# Overwrite by env SRS_RTC_SERVER_CANDIDATE
# default: *
candidate *;
# If candidate is * or 0.0.0.0, means SRS could detect IP automatically, filtered by ip_family.
# You can config this to off to disable the detecting, then SRS will try to parse the API hostname.
# Note that browser might fail if no CANDIDATE specified.
# Overwrite by env SRS_RTC_SERVER_USE_AUTO_DETECT_NETWORK_IP
# Default: on
use_auto_detect_network_ip on;
# 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.
# Overwrite by env SRS_RTC_SERVER_IP_FAMILY
# default: ipv4
ip_family ipv4;
# If api_as_candidates is on, SRS would try to use the IP of api server, specified by srs.sdk.js request:
# api:string "http://r.ossrs.net:1985/rtc/v1/play/"
# in this case, the r.ossrs.net and 39.107.238.185 will be added as candidates.
# Overwrite by env SRS_RTC_SERVER_API_AS_CANDIDATES
# Default: on
api_as_candidates on;
# If use api as CANDIDATE, whether resolve the api hostname.
# Note that use original domain name as CANDIDATE, which might make Firefox failed, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
# Note that if hostname is IPv4 address, always directly use it.
# Overwrite by env SRS_RTC_SERVER_RESOLVE_API_DOMAIN
# Default: on
resolve_api_domain on;
# If use api as CANDIDATE, whether keep original api domain name as CANDIDATE.
# Note that use original domain name as CANDIDATE, which might make Firefox failed, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
# Overwrite by env SRS_RTC_SERVER_KEEP_API_DOMAIN
# Default: off
keep_api_domain off;
# Whether use ECDSA certificate.
Expand Down Expand Up @@ -369,6 +407,7 @@ rtc_server {
vhost rtc.vhost.srs.com {
rtc {
# Whether enable WebRTC server.
# Overwrite by env SRS_VHOST_RTC_ENABLED for all vhosts.
# default: off
enabled on;
# Whether support NACK.
Expand Down Expand Up @@ -399,6 +438,7 @@ vhost rtc.vhost.srs.com {
###############################################################
# Whether enable transmuxing RTMP to RTC.
# If enabled, transcode aac to opus.
# Overwrite by env SRS_VHOST_RTC_RTMP_TO_RTC for all vhosts.
# default: off
rtmp_to_rtc off;
# Whether keep B-frame, which is normal feature in live streaming,
Expand All @@ -407,6 +447,7 @@ vhost rtc.vhost.srs.com {
keep_bframe off;
###############################################################
# Whether enable transmuxing RTC to RTMP.
# Overwrite by env SRS_VHOST_RTC_RTC_TO_RTMP for all vhosts.
# Default: off
rtc_to_rtmp off;
# The PLI interval in seconds, for RTC to RTMP.
Expand Down
2 changes: 1 addition & 1 deletion trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ if [[ $SRS_SRT == YES ]]; then
MODULE_FILES+=("srs_app_srt_server" "srs_app_srt_listener" "srs_app_srt_conn" "srs_app_srt_utility" "srs_app_srt_source")
fi
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp"
MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp" "srs_app_rtc_network"
"srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
fi
if [[ $SRS_FFMPEG_FIT == YES ]]; then
Expand Down
1 change: 1 addition & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2022-09-04, Fix [#2852](https://github.com/ossrs/srs/issues/2852): WebRTC: WebRTC over TCP directly, not TURN. v5.0.60
* v5.0, 2022-09-01, Fix [#1405](https://github.com/ossrs/srs/issues/1405): Restore the stream when parsing failed. v5.0.59
* v5.0, 2022-09-01, Fix [#1405](https://github.com/ossrs/srs/issues/1405): Support guessing IBMF first. v5.0.58
* v5.0, 2022-09-01, ST: Define and use a new jmpbuf. v5.0.57
Expand Down
4 changes: 0 additions & 4 deletions trunk/src/app/srs_app_caster_flv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ srs_error_t SrsDynamicHttpConn::start()
return srs_error_wrap(err, "set cors=%d", v);
}

if ((err = skt->initialize()) != srs_success) {
return srs_error_wrap(err, "init socket");
}

return conn->start();
}

Expand Down
Loading