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-04-26 18:08:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
acba4cfdc6e5f7fcc6dcdd15b934034cd0c98ad6
acba4cfd
1 parent
b0951d36
add edge framework
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
84 行增加
和
2 行删除
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_edge.hpp
trunk/src/kernel/srs_kernel_error.hpp
trunk/src/app/srs_app_edge.cpp
查看文件 @
acba4cf
...
...
@@ -25,21 +25,63 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp.hpp>
#include <srs_kernel_log.hpp>
// when error, edge ingester sleep for a while and retry.
#define SRS_EDGE_INGESTER_SLEEP_US (int64_t)(3*1000*1000LL)
SrsEdgeIngester
::
SrsEdgeIngester
()
{
_edge
=
NULL
;
_req
=
NULL
;
pthread
=
new
SrsThread
(
this
,
SRS_EDGE_INGESTER_SLEEP_US
);
}
SrsEdgeIngester
::~
SrsEdgeIngester
()
{
}
int
SrsEdgeIngester
::
initialize
(
SrsEdge
*
edge
,
SrsRequest
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
_edge
=
edge
;
_req
=
req
;
return
ret
;
}
int
SrsEdgeIngester
::
start
()
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
//return pthread->start();
}
int
SrsEdgeIngester
::
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
}
SrsEdge
::
SrsEdge
()
{
state
=
SrsEdgeStateInit
;
ingester
=
new
SrsEdgeIngester
();
}
SrsEdge
::~
SrsEdge
()
{
srs_freep
(
ingester
);
}
int
SrsEdge
::
initialize
(
SrsRequest
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
_req
=
req
;
if
((
ret
=
ingester
->
initialize
(
this
,
req
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
...
...
@@ -47,6 +89,20 @@ int SrsEdge::initialize(SrsRequest* req)
int
SrsEdge
::
on_client_play
()
{
int
ret
=
ERROR_SUCCESS
;
// error state.
if
(
state
==
SrsEdgeStateAborting
||
state
==
SrsEdgeStateReloading
)
{
ret
=
ERROR_RTMP_EDGE_PLAY_STATE
;
srs_error
(
"invalid state for client to play stream on edge. state=%d, ret=%d"
,
state
,
ret
);
return
ret
;
}
// start ingest when init state.
if
(
state
==
SrsEdgeStateInit
)
{
state
=
SrsEdgeStatePlay
;
return
ingester
->
start
();
}
return
ret
;
}
...
...
trunk/src/app/srs_app_edge.hpp
查看文件 @
acba4cf
...
...
@@ -30,6 +30,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
#include <srs_app_thread.hpp>
class
SrsEdge
;
class
SrsRequest
;
/**
...
...
@@ -46,13 +49,33 @@ enum SrsEdgeState
};
/**
* edge used to ingest stream from origin.
*/
class
SrsEdgeIngester
:
public
ISrsThreadHandler
{
private
:
SrsEdge
*
_edge
;
SrsRequest
*
_req
;
SrsThread
*
pthread
;
public
:
SrsEdgeIngester
();
virtual
~
SrsEdgeIngester
();
public
:
virtual
int
initialize
(
SrsEdge
*
edge
,
SrsRequest
*
req
);
virtual
int
start
();
// interface ISrsThreadHandler
public:
virtual
int
cycle
();
};
/**
* edge control service.
*/
class
SrsEdge
{
private
:
SrsRequest
*
_req
;
SrsEdgeState
state
;
SrsEdgeIngester
*
ingester
;
public
:
SrsEdge
();
virtual
~
SrsEdge
();
...
...
trunk/src/kernel/srs_kernel_error.hpp
查看文件 @
acba4cf
...
...
@@ -76,6 +76,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// 2. srs-librtmp return error, to terminate the program.
#define ERROR_RTMP_HS_SSL_REQUIRE 318
#define ERROR_RTMP_DURATION_EXCEED 319
// edge specified errors
// invalid state for client to play edge stream.
#define ERROR_RTMP_EDGE_PLAY_STATE 320
#define ERROR_SYSTEM_STREAM_INIT 400
#define ERROR_SYSTEM_PACKET_INVALID 401
...
...
请
注册
或
登录
后发表评论