From 10b9a81061f31cd20228244137a73cea528b5f34 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 8 Jul 2021 14:25:38 +0800 Subject: [PATCH] RTC: Support eip/candidate to set the eip of server --- trunk/research/players/js/srs.sdk.js | 8 ++++---- trunk/src/app/srs_app_rtc_api.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/trunk/research/players/js/srs.sdk.js b/trunk/research/players/js/srs.sdk.js index 5151aebb4..1bfff4d1e 100644 --- a/trunk/research/players/js/srs.sdk.js +++ b/trunk/research/players/js/srs.sdk.js @@ -33,8 +33,8 @@ function SrsRtcPublisherAsync() { // webrtc://r.ossrs.net:11985/live/mystream // or set the api server to myapi.domain.com: // webrtc://myapi.domain.com/live/livestream - // or set the candidate(ip) of answer: - // webrtc://r.ossrs.net/live/livestream?eip=39.107.238.185 + // or set the candidate(eip) of answer: + // webrtc://r.ossrs.net/live/livestream?candidate=39.107.238.185 // or force to access https API: // webrtc://r.ossrs.net/live/livestream?schema=https // or use plaintext, without SRTP: @@ -272,8 +272,8 @@ function SrsRtcPlayerAsync() { // webrtc://r.ossrs.net:11985/live/mystream // or set the api server to myapi.domain.com: // webrtc://myapi.domain.com/live/livestream - // or set the candidate(ip) of answer: - // webrtc://r.ossrs.net/live/livestream?eip=39.107.238.185 + // or set the candidate(eip) of answer: + // webrtc://r.ossrs.net/live/livestream?candidate=39.107.238.185 // or force to access https API: // webrtc://r.ossrs.net/live/livestream?schema=https // or use plaintext, without SRTP: diff --git a/trunk/src/app/srs_app_rtc_api.cpp b/trunk/src/app/srs_app_rtc_api.cpp index dd43d5233..bbadedf0e 100644 --- a/trunk/src/app/srs_app_rtc_api.cpp +++ b/trunk/src/app/srs_app_rtc_api.cpp @@ -118,8 +118,11 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe srs_discovery_tc_url(tcUrl, schema, host, vhost, app, stream_name, port, param); } - // For client to specifies the EIP of server. + // For client to specifies the candidate(EIP) of server. string eip = r->query_get("eip"); + if (eip.empty()) { + eip = r->query_get("candidate"); + } string codec = r->query_get("codec"); // For client to specifies whether encrypt by SRTP. string srtp = r->query_get("encrypt"); @@ -338,8 +341,11 @@ srs_error_t SrsGoApiRtcPublish::do_serve_http(ISrsHttpResponseWriter* w, ISrsHtt srs_discovery_tc_url(tcUrl, schema, host, vhost, app, stream_name, port, param); } - // For client to specifies the EIP of server. + // For client to specifies the candidate(EIP) of server. string eip = r->query_get("eip"); + if (eip.empty()) { + eip = r->query_get("candidate"); + } string codec = r->query_get("codec"); srs_trace("RTC publish %s, api=%s, tid=%s, clientip=%s, app=%s, stream=%s, offer=%dB, eip=%s, codec=%s",