From a42cf3ae8db71414f754456fa62f20ccb26489d6 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 14 Mar 2020 18:05:58 +0800 Subject: [PATCH] For #1638, #307, refactor rtc config. --- trunk/conf/rtc.conf | 6 +++++- trunk/research/players/rtc.html | 2 +- trunk/src/app/srs_app_config.cpp | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/trunk/conf/rtc.conf b/trunk/conf/rtc.conf index 03b42c75d1..300b81d6f4 100644 --- a/trunk/conf/rtc.conf +++ b/trunk/conf/rtc.conf @@ -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; @@ -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__ { diff --git a/trunk/research/players/rtc.html b/trunk/research/players/rtc.html index 80cd1a2c08..550467aa11 100644 --- a/trunk/research/players/rtc.html +++ b/trunk/research/players/rtc.html @@ -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; diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index cb47e12e01..b79fdadd76 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -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()); }