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-05-26 08:25:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f03198c360e40978b35d7fcdbf32d4d3d1b8ba34
f03198c3
1 parent
a0bf6138
fix bug: using port of input source server as the input port of the source of transcoding
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
26 行增加
和
25 行删除
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_encoder.cpp
trunk/src/app/srs_app_forward.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_source.hpp
trunk/src/protocol/srs_rtmp_stack.cpp
trunk/src/app/srs_app_edge.cpp
查看文件 @
f03198c
...
...
@@ -96,7 +96,7 @@ int SrsEdgeIngester::start()
{
int
ret
=
ERROR_SUCCESS
;
if
((
ret
=
_source
->
on_publish
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_source
->
on_publish
(
_req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"edge pull stream then publish to edge failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/src/app/srs_app_encoder.cpp
查看文件 @
f03198c
...
...
@@ -253,6 +253,8 @@ int SrsEncoder::parse_ffmpeg(SrsRequest* req, SrsConfDirective* conf)
return
ret
;
}
extern
char
rtmp_port
[
16
];
int
SrsEncoder
::
initialize_ffmpeg
(
SrsFFMPEG
*
ffmpeg
,
SrsRequest
*
req
,
SrsConfDirective
*
engine
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -263,7 +265,7 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
input
=
"rtmp://"
;
input
+=
SRS_CONSTS_LOCALHOST
;
input
+=
":"
;
input
+=
r
eq
->
port
;
input
+=
r
tmp_
port
;
input
+=
"/"
;
input
+=
req
->
app
;
input
+=
"?vhost="
;
...
...
trunk/src/app/srs_app_forward.cpp
查看文件 @
f03198c
...
...
@@ -82,7 +82,7 @@ SrsForwarder::~SrsForwarder()
int
SrsForwarder
::
check_dead_loop
(
SrsRequest
*
req
,
std
::
string
ep_forward
)
{
int
ret
=
ERROR_SUCCESS
;
std
::
string
server
,
port
,
tc_url
;
std
::
string
server
,
port
;
server
=
ep_forward
;
port
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
...
...
@@ -94,16 +94,12 @@ int SrsForwarder::check_dead_loop(SrsRequest* req, std::string ep_forward)
server
=
ep_forward
.
substr
(
0
,
pos
);
}
// generate tcUrl
tc_url
=
srs_generate_tc_url
(
server
,
req
->
vhost
,
req
->
app
,
port
,
req
->
param
);
// dead loop check
std
::
string
source_ep
=
"rtmp://"
;
source_ep
+=
req
->
host
;
source_ep
+=
":"
;
source_ep
+=
req
->
port
;
source_ep
+=
"?vhost="
;
source_ep
+=
req
->
vhost
;
std
::
string
dest_ep
=
"rtmp://"
;
if
(
ep_forward
==
SRS_CONSTS_LOCALHOST
)
{
...
...
@@ -114,8 +110,6 @@ int SrsForwarder::check_dead_loop(SrsRequest* req, std::string ep_forward)
}
dest_ep
+=
":"
;
dest_ep
+=
port
;
dest_ep
+=
"?vhost="
;
dest_ep
+=
req
->
vhost
;
if
(
source_ep
==
dest_ep
)
{
ret
=
ERROR_SYSTEM_FORWARD_LOOP
;
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
f03198c
...
...
@@ -986,7 +986,7 @@ int SrsRtmpConn::acquire_publish(SrsSource* source, bool is_edge)
return
ret
;
}
}
else
{
if
((
ret
=
source
->
on_publish
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
source
->
on_publish
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"notify publish failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
f03198c
...
...
@@ -1068,6 +1068,8 @@ int SrsServer::do_cycle()
return
ret
;
}
char
rtmp_port
[
16
]
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
int
SrsServer
::
listen_rtmp
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1078,6 +1080,8 @@ int SrsServer::listen_rtmp()
close_listeners
(
SrsListenerRtmpStream
);
int
first_port
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
ip_ports
.
size
();
i
++
)
{
SrsListener
*
listener
=
new
SrsStreamListener
(
this
,
SrsListenerRtmpStream
);
listeners
.
push_back
(
listener
);
...
...
@@ -1090,8 +1094,14 @@ int SrsServer::listen_rtmp()
srs_error
(
"RTMP stream listen at %s:%d failed. ret=%d"
,
ip
.
c_str
(),
port
,
ret
);
return
ret
;
}
if
(
!
first_port
){
first_port
=
port
;
}
}
snprintf
(
rtmp_port
,
16
,
"%d"
,
first_port
);
return
ret
;
}
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
f03198c
...
...
@@ -1233,7 +1233,7 @@ int SrsSource::on_reload_vhost_forward(string vhost)
return
ret
;
}
if
((
ret
=
create_forwarders
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
create_forwarders
(
_req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"create forwarders failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -2193,7 +2193,7 @@ int SrsSource::on_aggregate(SrsCommonMessage* msg)
return
ret
;
}
int
SrsSource
::
on_publish
()
int
SrsSource
::
on_publish
(
SrsRequest
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -2214,7 +2214,7 @@ int SrsSource::on_publish()
last_packet_time
=
0
;
// create forwarders
if
((
ret
=
create_forwarders
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
create_forwarders
(
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"create forwarders failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -2420,7 +2420,7 @@ void SrsSource::on_edge_proxy_unpublish()
publish_edge
->
on_proxy_unpublish
();
}
int
SrsSource
::
create_forwarders
()
int
SrsSource
::
create_forwarders
(
SrsRequest
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -2429,7 +2429,7 @@ int SrsSource::create_forwarders()
for
(
int
i
=
0
;
conf
&&
i
<
(
int
)
conf
->
args
.
size
();
i
++
)
{
std
::
string
forward_server
=
conf
->
args
.
at
(
i
);
if
(
SrsForwarder
::
check_dead_loop
(
_req
,
forward_server
))
{
//if the source is from any of the peer list,don't forward it
if
(
SrsForwarder
::
check_dead_loop
(
req
,
forward_server
))
{
//if the source is from any of the peer list,don't forward it
srs_trace
(
"the source is come from forward_peer,don't forward it any more: "
"vhost=%s, app=%s, stream=%s, forward-to=%s"
,
_req
->
vhost
.
c_str
(),
_req
->
app
.
c_str
(),
_req
->
stream
.
c_str
(),
...
...
@@ -2470,7 +2470,7 @@ int SrsSource::create_forwarders()
for
(
int
i
=
0
;
conf
&&
i
<
(
int
)
conf
->
args
.
size
();
i
++
)
{
std
::
string
forward_server
=
conf
->
args
.
at
(
i
);
if
(
SrsForwarder
::
check_dead_loop
(
_
req
,
forward_server
))
{
if
(
SrsForwarder
::
check_dead_loop
(
req
,
forward_server
))
{
srs_trace
(
"start forward,dead loop checked,don't forward it: "
"vhost=%s, app=%s, stream=%s, forward-to=%s"
,
_req
->
vhost
.
c_str
(),
_req
->
app
.
c_str
(),
_req
->
stream
.
c_str
(),
...
...
@@ -2519,7 +2519,7 @@ int SrsSource::create_forwarders()
std
::
string
forward_server
=
conf
->
args
.
at
(
server_index
);
server_index
++
;
if
(
SrsForwarder
::
check_dead_loop
(
_
req
,
forward_server
))
{
if
(
SrsForwarder
::
check_dead_loop
(
req
,
forward_server
))
{
srs_trace
(
"start forward_in_turn,dead loop checked,don't forward it: "
"vhost=%s, app=%s, stream=%s, forward-to=%s"
,
_req
->
vhost
.
c_str
(),
_req
->
app
.
c_str
(),
_req
->
stream
.
c_str
(),
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
f03198c
...
...
@@ -571,7 +571,7 @@ public:
* @param _req the request from client, the source will deep copy it,
* for when reload the request of client maybe invalid.
*/
virtual
int
on_publish
();
virtual
int
on_publish
(
SrsRequest
*
req
);
virtual
void
on_unpublish
();
// consumer methods
public:
...
...
@@ -598,7 +598,7 @@ public:
// for edge, proxy stop publish
virtual
void
on_edge_proxy_unpublish
();
private
:
virtual
int
create_forwarders
();
virtual
int
create_forwarders
(
SrsRequest
*
req
);
virtual
void
destroy_forwarders
();
};
...
...
trunk/src/protocol/srs_rtmp_stack.cpp
查看文件 @
f03198c
...
...
@@ -1765,11 +1765,6 @@ void SrsRequest::update_auth(SrsRequest* req)
swfUrl
=
req
->
swfUrl
;
tcUrl
=
req
->
tcUrl
;
vhost
=
req
->
vhost
;
app
=
req
->
app
;
param
=
req
->
param
;
port
=
req
->
port
;
if
(
args
)
{
srs_freep
(
args
);
}
...
...
请
注册
或
登录
后发表评论