Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-04-03 10:56:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
17c0a5c4702436008837b58b19b85b10f7be5580
17c0a5c4
1 parent
4d98cbb9
fix #372, support transform vhost of edge 2.0.155.
显示空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
91 行增加
和
8 行删除
README.md
trunk/conf/full.conf
trunk/conf/transform.edge.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_edge.cpp
trunk/src/core/srs_core.hpp
README.md
查看文件 @
17c0a5c
...
...
@@ -562,6 +562,7 @@ Supported operating systems and hardware:
### SRS 2.0 history
*
v2.0, 2015-03-30, for
[
#372
](
https://github.com/winlinvip/simple-rtmp-server/issues/372
)
, support transform vhost of edge 2.0.155.
*
v2.0, 2015-03-30, for
[
#366
](
https://github.com/winlinvip/simple-rtmp-server/issues/366
)
, config hls to disable cleanup of ts. 2.0.154.
*
v2.0, 2015-03-31, support server cycle handler. 2.0.153.
*
v2.0, 2015-03-31, support on_hls for http hooks. 2.0.152.
...
...
trunk/conf/full.conf
查看文件 @
17c0a5c
...
...
@@ -284,6 +284,17 @@ vhost same.edge.srs.com {
token_traverse
off
;
}
# vhost for edge, edge transform vhost to fetch from another vhost.
vhost
transform
.
edge
.
srs
.
com
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
# the vhost to transform for edge,
# to fetch from the specified vhost at origin,
# if not specified, use the current vhost of edge in origin, the variable [vhost].
# default: [vhost]
vhost
same
.
edge
.
srs
.
com
;
}
# vhost for dvr
vhost
dvr
.
srs
.
com
{
# dvr RTMP stream to file,
...
...
trunk/conf/transform.edge.conf
0 → 100644
查看文件 @
17c0a5c
# the config for srs origin-edge cluster
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Edge#transform-vhost
# @see full.conf for detail config.
listen
1935
;
max_connections
1000
;
vhost
__
defaultVhost__
{
}
vhost
source
.
srs
.
com
{
ingest
livestream
{
enabled
on
;
input
{
type
file
;
url
./
doc
/
source
.
200
kbps
.
768
x320
.
flv
;
}
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/
live
?
vhost
=[
vhost
]/
livestream
;
}
}
}
vhost
transform
.
srs
.
edge
.
com
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
vhost
source
.
srs
.
com
;
}
\ No newline at end of file
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
17c0a5c
...
...
@@ -1409,7 +1409,7 @@ int SrsConfig::check_config()
SrsConfDirective
*
conf
=
vhost
->
at
(
i
);
string
n
=
conf
->
name
;
if
(
n
!=
"enabled"
&&
n
!=
"chunk_size"
&&
n
!=
"mode"
&&
n
!=
"origin"
&&
n
!=
"token_traverse"
&&
n
!=
"mode"
&&
n
!=
"origin"
&&
n
!=
"token_traverse"
&&
n
!=
"vhost"
&&
n
!=
"dvr"
&&
n
!=
"ingest"
&&
n
!=
"hls"
&&
n
!=
"http_hooks"
&&
n
!=
"gop_cache"
&&
n
!=
"queue_length"
&&
n
!=
"refer"
&&
n
!=
"refer_publish"
&&
n
!=
"refer_play"
...
...
@@ -2517,12 +2517,12 @@ bool SrsConfig::get_vhost_is_edge(SrsConfDirective* vhost)
SrsConfDirective
*
conf
=
vhost
;
if
(
!
conf
)
{
return
false
;
return
SRS_CONF_DEFAULT_EDGE_MODE
;
}
conf
=
conf
->
get
(
"mode"
);
if
(
!
conf
||
conf
->
arg0
()
!=
"remote"
)
{
return
false
;
return
SRS_CONF_DEFAULT_EDGE_MODE
;
}
return
true
;
...
...
@@ -2544,17 +2544,33 @@ bool SrsConfig::get_vhost_edge_token_traverse(string vhost)
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
false
;
return
SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE
;
}
conf
=
conf
->
get
(
"token_traverse"
);
if
(
!
conf
||
conf
->
arg0
()
!=
"on"
)
{
return
false
;
return
SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE
;
}
return
true
;
}
string
SrsConfig
::
get_vhost_edge_transform_vhost
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST
;
}
conf
=
conf
->
get
(
"vhost"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST
;
}
return
conf
->
arg0
();
}
bool
SrsConfig
::
get_security_enabled
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
17c0a5c
...
...
@@ -106,6 +106,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_CONF_DEFAULT_TRANSCODE_IFORMAT "flv"
#define SRS_CONF_DEFAULT_TRANSCODE_OFORMAT "flv"
#define SRS_CONF_DEFAULT_EDGE_MODE false
#define SRS_CONF_DEFAULT_EDGE_TOKEN_TRAVERSE false
#define SRS_CONF_DEFAULT_EDGE_TRANSFORM_VHOST "[vhost]"
// hds default value
#define SRS_CONF_DEFAULT_HDS_PATH "./objs/nginx/html"
#define SRS_CONF_DEFAULT_HDS_WINDOW (60)
...
...
@@ -688,6 +692,11 @@ public:
* all clients connected to edge must be tranverse to origin to verify.
*/
virtual
bool
get_vhost_edge_token_traverse
(
std
::
string
vhost
);
/**
* get the transformed vhost for edge,
* @see https://github.com/winlinvip/simple-rtmp-server/issues/372
*/
virtual
std
::
string
get_vhost_edge_transform_vhost
(
std
::
string
vhost
);
// vhost security section
public:
/**
...
...
trunk/src/app/srs_app_edge.cpp
查看文件 @
17c0a5c
...
...
@@ -43,6 +43,7 @@ using namespace std;
#include <srs_rtmp_msg_array.hpp>
#include <srs_app_utility.hpp>
#include <srs_rtmp_amf0.hpp>
#include <srs_kernel_utility.hpp>
// when error, edge ingester sleep for a while and retry.
#define SRS_EDGE_INGESTER_SLEEP_US (int64_t)(1*1000*1000LL)
...
...
@@ -240,9 +241,18 @@ int SrsEdgeIngester::connect_app(string ep_server, string ep_port)
std
::
string
local_ip
=
ips
[
_srs_config
->
get_stats_network
()];
data
->
set
(
"srs_server_ip"
,
SrsAmf0Any
::
str
(
local_ip
.
c_str
()));
// support vhost tranform for edge,
// @see https://github.com/winlinvip/simple-rtmp-server/issues/372
std
::
string
vhost
=
_srs_config
->
get_vhost_edge_transform_vhost
(
req
->
vhost
);
vhost
=
srs_string_replace
(
vhost
,
"[vhost]"
,
req
->
vhost
);
// generate the tcUrl
std
::
string
param
=
""
;
std
::
string
tc_url
=
srs_generate_tc_url
(
ep_server
,
req
->
vhost
,
req
->
app
,
ep_port
,
param
);
std
::
string
tc_url
=
srs_generate_tc_url
(
ep_server
,
vhost
,
req
->
app
,
ep_port
,
param
);
srs_trace
(
"edge ingest from %s:%s at %s"
,
ep_server
.
c_str
(),
ep_port
.
c_str
(),
tc_url
.
c_str
());
// replace the tcUrl in request,
// which will replace the tc_url in client.connect_app().
req
->
tcUrl
=
tc_url
;
// upnode server identity will show in the connect_app of client.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/160
...
...
@@ -662,9 +672,18 @@ int SrsEdgeForwarder::connect_app(string ep_server, string ep_port)
std
::
string
local_ip
=
ips
[
_srs_config
->
get_stats_network
()];
data
->
set
(
"srs_server_ip"
,
SrsAmf0Any
::
str
(
local_ip
.
c_str
()));
// support vhost tranform for edge,
// @see https://github.com/winlinvip/simple-rtmp-server/issues/372
std
::
string
vhost
=
_srs_config
->
get_vhost_edge_transform_vhost
(
req
->
vhost
);
vhost
=
srs_string_replace
(
vhost
,
"[vhost]"
,
req
->
vhost
);
// generate the tcUrl
std
::
string
param
=
""
;
std
::
string
tc_url
=
srs_generate_tc_url
(
ep_server
,
req
->
vhost
,
req
->
app
,
ep_port
,
param
);
std
::
string
tc_url
=
srs_generate_tc_url
(
ep_server
,
vhost
,
req
->
app
,
ep_port
,
param
);
srs_trace
(
"edge forward to %s:%s at %s"
,
ep_server
.
c_str
(),
ep_port
.
c_str
(),
tc_url
.
c_str
());
// replace the tcUrl in request,
// which will replace the tc_url in client.connect_app().
req
->
tcUrl
=
tc_url
;
// upnode server identity will show in the connect_app of client.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/160
...
...
trunk/src/core/srs_core.hpp
查看文件 @
17c0a5c
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 15
4
#define VERSION_REVISION 15
5
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
请
注册
或
登录
后发表评论