Skip to content

Commit a42cf3a

Browse files
committed
For #1638, #307, refactor rtc config.
1 parent 6f4584d commit a42cf3a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

trunk/conf/rtc.conf

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ listen 1935;
33
max_connections 1000;
44
srs_log_tank console;
55
srs_log_file ./objs/srs.log;
6+
daemon off;
67

78
http_server {
89
enabled on;
@@ -21,10 +22,13 @@ rtc {
2122
enabled on;
2223
# Listen at udp://8000
2324
listen 8000;
25+
#
26+
# The $CANDIDATE means fetch from env, if not configed, use default * as bellow.
27+
#
2428
# The * means using IP of network interface stats.network,
2529
# For example, if stats.network=0, then use IP of eth0 as candidate.
2630
# @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
27-
candidate *;
31+
candidate $CANDIDATE;
2832
}
2933

3034
vhost __defaultVhost__ {

trunk/research/players/rtc.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
1717
var SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription;
1818

19-
var url = "http://localhost:1985/api/v1/sdp/";
19+
var url = document.location.protocol + "//" + document.location.hostname + ":1985/api/v1/sdp/";
2020

2121
var method = "POST";
2222
var shouldBeAsync = true;

trunk/src/app/srs_app_config.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -4323,6 +4323,11 @@ std::string SrsConfig::get_rtc_candidates()
43234323
if (!eip.empty()) {
43244324
return eip;
43254325
}
4326+
4327+
// If configed as ENV, but no ENV set, use default value.
4328+
if (srs_string_starts_with(conf->arg0(), "$")) {
4329+
return DEFAULT;
4330+
}
43264331

43274332
return (conf->arg0().c_str());
43284333
}

0 commit comments

Comments
 (0)