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
胡斌
2017-07-17 16:00:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8d411235f3487c4463a365017e35510691e49725
8d411235
1 parent
9354d4a9
add conf directive forward_append_stream_name,to support add ?vhost=xxxx to stre…
…am name when forward to cdn
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
33 行增加
和
3 行删除
trunk/conf/forward.master.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_forward.cpp
trunk/src/app/srs_app_forward.hpp
trunk/conf/forward.master.conf
查看文件 @
8d41123
# the c
o
nfig for srs to forward
# the c
wrd_stream_name_append
nfig for srs to forward
# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleForward
# @see full.conf for detail config.
...
...
@@ -16,4 +16,6 @@ vhost __defaultVhost__ {
#if the forward server is same as this server , a origin,try use forward_peer,
#the stream pushed from other forward peer will not forward any more in this server
forward_peer
127
.
0
.
0
.
1
:
1936
;
#append the string after start with ? to the stream name when forward to the server
forward_append_stream_name
127
.
0
.
0
.
1
:
19350
?
vhost
=
newrtmp
.
xuedianyun
.
com
}
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
8d41123
...
...
@@ -1832,7 +1832,8 @@ int SrsConfig::check_config()
&&
n
!=
"dvr"
&&
n
!=
"ingest"
&&
n
!=
"hls"
&&
n
!=
"http_hooks"
&&
n
!=
"gop_cache"
&&
n
!=
"queue_length"
&&
n
!=
"refer"
&&
n
!=
"refer_publish"
&&
n
!=
"refer_play"
&&
n
!=
"forward"
&&
n
!=
"forward_server_other"
&&
n
!=
"forward_in_turn"
&&
n
!=
"forward_peer"
&&
n
!=
"transcode"
&&
n
!=
"bandcheck"
&&
n
!=
"forward"
&&
n
!=
"transcode"
&&
n
!=
"bandcheck"
&&
n
!=
"forward_server_other"
&&
n
!=
"forward_in_turn"
&&
n
!=
"forward_peer"
&&
n
!=
"forward_append_stream_name"
&&
n
!=
"time_jitter"
&&
n
!=
"mix_correct"
&&
n
!=
"atc"
&&
n
!=
"atc_auto"
&&
n
!=
"debug_srs_upnode"
...
...
@@ -2816,6 +2817,17 @@ SrsConfDirective* SrsConfig::get_forward_in_turn(string vhost)
return
conf
->
get
(
"forward_in_turn"
);
}
SrsConfDirective
*
SrsConfig
::
get_forward_append_stream_name
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
return
conf
->
get
(
"forward_append_stream_name"
);
}
SrsConfDirective
*
SrsConfig
::
get_forward_peer
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
8d41123
...
...
@@ -581,6 +581,10 @@ public:
* get the forward_peer directive of vhost.
*/
virtual
SrsConfDirective
*
get_forward_peer
(
std
::
string
vhost
);
/**
* get the forward_append_stream_name directive of vhost.
*/
virtual
SrsConfDirective
*
get_forward_append_stream_name
(
std
::
string
vhost
);
// http_hooks section
private:
/**
...
...
trunk/src/app/srs_app_forward.cpp
查看文件 @
8d41123
...
...
@@ -138,6 +138,16 @@ int SrsForwarder::initialize(SrsRequest* req, string ep_forward)
}
}
size_t
ep_len
=
ep_forward
.
length
();
conf
=
_srs_config
->
get_forward_append_stream_name
(
_req
->
vhost
);
for
(
int
i
=
0
;
conf
&&
i
<
(
int
)
conf
->
args
.
size
();
i
++
)
{
std
::
string
forward_append_stream_name
=
conf
->
args
.
at
(
i
);
if
(
forward_append_stream_name
.
length
()
>
ep_len
&&
forward_append_stream_name
.
at
(
ep_len
)
==
'?'
&&
!
strncmp
(
ep_forward
.
c_str
(),
forward_append_stream_name
.
c_str
(),
ep_len
)){
_steam_name_appender
=
forward_append_stream_name
.
substr
(
ep_len
,
forward_append_stream_name
.
length
());
break
;
}
}
return
ret
;
}
...
...
@@ -300,7 +310,7 @@ int SrsForwarder::cycle()
return
ret
;
}
if
((
ret
=
client
->
publish
(
_req
->
stream
,
stream_id
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
client
->
publish
(
_req
->
stream
+
_steam_name_appender
,
stream_id
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"connect with server failed, stream_name=%s, stream_id=%d. ret=%d"
,
_req
->
stream
.
c_str
(),
stream_id
,
ret
);
return
ret
;
...
...
trunk/src/app/srs_app_forward.hpp
查看文件 @
8d41123
...
...
@@ -55,6 +55,8 @@ private:
std
::
string
_ep_forward
;
SrsRequest
*
_req
;
int
stream_id
;
// the string append to stream name ,such as "?vhost=newrtmp.xuedianyun.com" for rtmp://video-center.alivecdn.com/live/test?vhost=newrtmp.xuedianyun.com
std
::
string
_steam_name_appender
;
private
:
st_netfd_t
stfd
;
SrsReusableThread2
*
pthread
;
...
...
请
注册
或
登录
后发表评论