diff --git a/README.md b/README.md index b40276857..c8eb328e9 100755 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ 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.flv) by: @@ -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: @@ -1258,8 +1257,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: @@ -1382,6 +1381,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 @@ -1812,7 +1813,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 diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index d33092cd4..978b237d0 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -446,14 +446,14 @@ 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. @@ -461,37 +461,38 @@ rtc_server { # 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. @@ -533,61 +534,58 @@ 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; } - # 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; } } diff --git a/trunk/conf/rtc.conf b/trunk/conf/rtc.conf index b5a70eb07..0a3360c9f 100644 --- a/trunk/conf/rtc.conf +++ b/trunk/conf/rtc.conf @@ -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; diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index e69f0772e..142881496 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -3789,8 +3789,7 @@ srs_error_t SrsConfig::check_normal_config() && n != "play" && n != "publish" && n != "cluster" && n != "security" && n != "http_remux" && n != "dash" && n != "http_static" && n != "hds" && n != "exec" - && n != "in_ack_size" && n != "out_ack_size" && n != "rtc" && n != "nack" - && n != "twcc") { + && n != "in_ack_size" && n != "out_ack_size" && n != "rtc") { return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal vhost.%s", n.c_str()); } // for each sub directives of vhost. @@ -5104,7 +5103,7 @@ bool SrsConfig::get_rtc_enabled(string vhost) bool SrsConfig::get_rtc_bframe_discard(string vhost) { - static bool DEFAULT = false; + static bool DEFAULT = true; SrsConfDirective* conf = get_rtc(vhost); @@ -5117,7 +5116,7 @@ bool SrsConfig::get_rtc_bframe_discard(string vhost) return DEFAULT; } - return conf->arg0() == "discard"; + return conf->arg0() != "keep"; } bool SrsConfig::get_rtc_aac_discard(string vhost) @@ -5214,7 +5213,7 @@ int SrsConfig::get_rtc_drop_for_pt(string vhost) { static int DEFAULT = 0; - SrsConfDirective* conf = get_vhost(vhost); + SrsConfDirective* conf = get_rtc(vhost); if (!conf) { return DEFAULT; } @@ -5231,7 +5230,7 @@ bool SrsConfig::get_rtc_nack_enabled(string vhost) { static bool DEFAULT = true; - SrsConfDirective* conf = get_vhost(vhost); + SrsConfDirective* conf = get_rtc(vhost); if (!conf) { return DEFAULT; } @@ -5241,11 +5240,6 @@ bool SrsConfig::get_rtc_nack_enabled(string vhost) return DEFAULT; } - conf = conf->get("enabled"); - if (!conf || conf->arg0().empty()) { - return DEFAULT; - } - return SRS_CONF_PERFER_TRUE(conf->arg0()); } @@ -5253,17 +5247,12 @@ bool SrsConfig::get_rtc_nack_no_copy(string vhost) { static bool DEFAULT = true; - SrsConfDirective* conf = get_vhost(vhost); + SrsConfDirective* conf = get_rtc(vhost); if (!conf) { return DEFAULT; } - conf = conf->get("nack"); - if (!conf) { - return DEFAULT; - } - - conf = conf->get("no_copy"); + conf = conf->get("nack_no_copy"); if (!conf || conf->arg0().empty()) { return DEFAULT; } @@ -5275,7 +5264,7 @@ bool SrsConfig::get_rtc_twcc_enabled(string vhost) { static bool DEFAULT = true; - SrsConfDirective* conf = get_vhost(vhost); + SrsConfDirective* conf = get_rtc(vhost); if (!conf) { return DEFAULT; } @@ -5285,11 +5274,6 @@ bool SrsConfig::get_rtc_twcc_enabled(string vhost) return DEFAULT; } - conf = conf->get("enabled"); - if (!conf || conf->arg0().empty()) { - return DEFAULT; - } - return SRS_CONF_PERFER_TRUE(conf->arg0()); } diff --git a/trunk/src/app/srs_app_http_stream.hpp b/trunk/src/app/srs_app_http_stream.hpp index 0e56a63c1..1ba6c1e5a 100755 --- a/trunk/src/app/srs_app_http_stream.hpp +++ b/trunk/src/app/srs_app_http_stream.hpp @@ -179,6 +179,7 @@ public: }; // HTTP Live Streaming, to transmux RTMP to HTTP FLV or other format. +// TODO: FIXME: Rename to SrsHttpLive class SrsLiveStream : public ISrsHttpHandler { private: diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 8a35b5155..84474fbd8 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -500,7 +500,8 @@ public: virtual void on_unpublish() = 0; }; -// live streaming source. +// The live streaming source. +// TODO: FIXME: Rename to SrsLiveStream. class SrsSource : public ISrsReloadHandler { friend class SrsOriginHub; diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 441c0fa7d..a4c0ba3bf 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -26,6 +26,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 91 +#define VERSION_REVISION 92 #endif