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
2014-08-06 09:57:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5b28355a0bf3fd37d00ac11d54de9b0a05a7dcaf
5b28355a
1 parent
3532b61e
fix #147, support identify the srs edge. 0.9.190.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
77 行增加
和
3 行删除
README.md
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_edge.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/core/srs_core.hpp
README.md
查看文件 @
5b28355
...
...
@@ -208,6 +208,7 @@ Supported operating systems and hardware:
*
2013-10-17, Created.
<br/>
## History
*
v1.0, 2014-08-06, fix
[
#147
](
https://github.com/winlinvip/simple-rtmp-server/issues/147
)
, support identify the srs edge. 0.9.190.
*
<strong>
v1.0, 2014-08-03,
[
1.0 mainline7(0.9.189)
](
https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline7
)
released. 57432 lines.
</strong>
*
v1.0, 2014-08-03, fix
[
#79
](
https://github.com/winlinvip/simple-rtmp-server/issues/79
)
, fix the reload remove edge assert bug. 0.9.189.
*
v1.0, 2014-08-03, fix
[
#57
](
https://github.com/winlinvip/simple-rtmp-server/issues/57
)
, use lock(acquire/release publish) to avoid duplicated publishing. 0.9.188.
...
...
trunk/src/app/srs_app_edge.cpp
查看文件 @
5b28355
...
...
@@ -46,6 +46,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_utility.hpp>
#include <srs_protocol_msg_array.hpp>
#include <srs_app_utility.hpp>
#include <srs_protocol_amf0.hpp>
// when error, edge ingester sleep for a while and retry.
#define SRS_EDGE_INGESTER_SLEEP_US (int64_t)(1*1000*1000LL)
...
...
@@ -131,8 +132,7 @@ int SrsEdgeIngester::cycle()
srs_error
(
"handshake with server failed. ret=%d"
,
ret
);
return
ret
;
}
if
((
ret
=
client
->
connect_app
(
req
->
app
,
req
->
tcUrl
,
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"connect with server failed, tcUrl=%s. ret=%d"
,
req
->
tcUrl
.
c_str
(),
ret
);
if
((
ret
=
connect_app
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
client
->
create_stream
(
stream_id
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -209,6 +209,49 @@ int SrsEdgeIngester::ingest()
return
ret
;
}
int
SrsEdgeIngester
::
connect_app
()
{
int
ret
=
ERROR_SUCCESS
;
SrsRequest
*
req
=
_req
;
// args of request takes the srs info.
if
(
req
->
args
==
NULL
)
{
req
->
args
=
SrsAmf0Any
::
object
();
}
// notify server the edge identity,
// @see https://github.com/winlinvip/simple-rtmp-server/issues/147
SrsAmf0Object
*
data
=
req
->
args
;
data
->
set
(
"srs_sig"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_KEY
));
data
->
set
(
"srs_server"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_KEY
" "
RTMP_SIG_SRS_VERSION
" ("
RTMP_SIG_SRS_URL_SHORT
")"
));
data
->
set
(
"srs_license"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_LICENSE
));
data
->
set
(
"srs_role"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_ROLE
));
data
->
set
(
"srs_url"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_URL
));
data
->
set
(
"srs_version"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_VERSION
));
data
->
set
(
"srs_site"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_WEB
));
data
->
set
(
"srs_email"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_EMAIL
));
data
->
set
(
"srs_copyright"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_COPYRIGHT
));
data
->
set
(
"srs_primary_authors"
,
SrsAmf0Any
::
str
(
RTMP_SIG_SRS_PRIMARY_AUTHROS
));
// for edge to directly get the id of client.
data
->
set
(
"srs_pid"
,
SrsAmf0Any
::
number
(
getpid
()));
data
->
set
(
"srs_id"
,
SrsAmf0Any
::
number
(
_srs_context
->
get_id
()));
// local ip of edge
std
::
vector
<
std
::
string
>
ips
=
srs_get_local_ipv4_ips
();
assert
(
_srs_config
->
get_stats_network
()
<
(
int
)
ips
.
size
());
std
::
string
local_ip
=
ips
[
_srs_config
->
get_stats_network
()];
data
->
set
(
"srs_server_ip"
,
SrsAmf0Any
::
str
(
local_ip
.
c_str
()));
// upnode server identity will show in the connect_app of client.
if
((
ret
=
client
->
connect_app
(
req
->
app
,
req
->
tcUrl
,
req
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"connect with server failed, tcUrl=%s. ret=%d"
,
req
->
tcUrl
.
c_str
(),
ret
);
return
ret
;
}
return
ret
;
}
int
SrsEdgeIngester
::
process_publish_message
(
SrsMessage
*
msg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_edge.hpp
查看文件 @
5b28355
...
...
@@ -101,6 +101,7 @@ private:
virtual
int
ingest
();
virtual
void
close_underlayer_socket
();
virtual
int
connect_server
();
virtual
int
connect_app
();
virtual
int
process_publish_message
(
SrsMessage
*
msg
);
};
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
5b28355
...
...
@@ -163,6 +163,35 @@ int SrsRtmpConn::do_cycle()
req
->
schema
.
c_str
(),
req
->
vhost
.
c_str
(),
req
->
port
.
c_str
(),
req
->
app
.
c_str
(),
(
req
->
args
?
"(obj)"
:
"null"
));
// show client identity
if
(
req
->
args
)
{
std
::
string
srs_version
;
std
::
string
srs_server_ip
;
int
srs_pid
=
0
;
int
srs_id
=
0
;
SrsAmf0Any
*
prop
=
NULL
;
if
((
prop
=
req
->
args
->
ensure_property_string
(
"srs_version"
))
!=
NULL
)
{
srs_version
=
prop
->
to_str
();
}
if
((
prop
=
req
->
args
->
ensure_property_string
(
"srs_server_ip"
))
!=
NULL
)
{
srs_server_ip
=
prop
->
to_str
();
}
if
((
prop
=
req
->
args
->
ensure_property_number
(
"srs_pid"
))
!=
NULL
)
{
srs_pid
=
(
int
)
prop
->
to_number
();
}
if
((
prop
=
req
->
args
->
ensure_property_number
(
"srs_id"
))
!=
NULL
)
{
srs_id
=
(
int
)
prop
->
to_number
();
}
srs_info
(
"edge-srs ip=%s, version=%s, pid=%d, id=%d"
,
srs_server_ip
.
c_str
(),
srs_version
.
c_str
(),
srs_pid
,
srs_id
);
if
(
srs_pid
>
0
)
{
srs_trace
(
"edge-srs ip=%s, version=%s, pid=%d, id=%d"
,
srs_server_ip
.
c_str
(),
srs_version
.
c_str
(),
srs_pid
,
srs_id
);
}
}
ret
=
service_cycle
();
http_hooks_on_close
();
...
...
trunk/src/core/srs_core.hpp
查看文件 @
5b28355
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "1
89
"
#define VERSION_REVISION "1
90
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
请
注册
或
登录
后发表评论