Skip to content

Commit

Permalink
For #1638, #307, refactor rtc config.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 14, 2020
1 parent 6f4584d commit a42cf3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion trunk/conf/rtc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ listen 1935;
max_connections 1000;
srs_log_tank console;
srs_log_file ./objs/srs.log;
daemon off;

http_server {
enabled on;
Expand All @@ -21,10 +22,13 @@ rtc {
enabled on;
# Listen at udp://8000
listen 8000;
#
# The $CANDIDATE means fetch from env, if not configed, use default * as bellow.
#
# The * means using IP of network interface stats.network,
# For example, if stats.network=0, then use IP of eth0 as candidate.
# @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
candidate *;
candidate $CANDIDATE;
}

vhost __defaultVhost__ {
Expand Down
2 changes: 1 addition & 1 deletion trunk/research/players/rtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription;

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

var method = "POST";
var shouldBeAsync = true;
Expand Down
5 changes: 5 additions & 0 deletions trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4323,6 +4323,11 @@ std::string SrsConfig::get_rtc_candidates()
if (!eip.empty()) {
return eip;
}

// If configed as ENV, but no ENV set, use default value.
if (srs_string_starts_with(conf->arg0(), "$")) {
return DEFAULT;
}

return (conf->arg0().c_str());
}
Expand Down

0 comments on commit a42cf3a

Please sign in to comment.