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-03-27 12:27:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ab3c6c92a0267ee764578e2fe7f914ac05ee377c
ab3c6c92
1 parent
aa89f9f5
rename srs-client to srs-rtmp-conn
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
62 行增加
和
57 行删除
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/rtmp/srs_protocol_rtmp.cpp
trunk/src/rtmp/srs_protocol_rtmp.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
ab3c6c9
...
...
@@ -43,7 +43,7 @@ using namespace std;
#include <srs_app_bandwidth.hpp>
#include <srs_app_socket.hpp>
Srs
Client
::
SrsClient
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
)
Srs
RtmpConn
::
SrsRtmpConn
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
)
:
SrsConnection
(
srs_server
,
client_stfd
)
{
ip
=
NULL
;
...
...
@@ -60,7 +60,7 @@ SrsClient::SrsClient(SrsServer* srs_server, st_netfd_t client_stfd)
_srs_config
->
subscribe
(
this
);
}
Srs
Client
::~
SrsClient
()
Srs
RtmpConn
::~
SrsRtmpConn
()
{
_srs_config
->
unsubscribe
(
this
);
...
...
@@ -77,7 +77,7 @@ SrsClient::~SrsClient()
}
// TODO: return detail message when error for client.
int
Srs
Client
::
do_cycle
()
int
Srs
RtmpConn
::
do_cycle
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -139,7 +139,7 @@ int SrsClient::do_cycle()
return
ret
;
}
int
Srs
Client
::
on_reload_vhost_removed
(
string
vhost
)
int
Srs
RtmpConn
::
on_reload_vhost_removed
(
string
vhost
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -156,7 +156,7 @@ int SrsClient::on_reload_vhost_removed(string vhost)
return
ret
;
}
int
Srs
Client
::
service_cycle
()
int
Srs
RtmpConn
::
service_cycle
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -232,11 +232,11 @@ int SrsClient::service_cycle()
return
ret
;
}
int
Srs
Client
::
stream_service_cycle
()
int
Srs
RtmpConn
::
stream_service_cycle
()
{
int
ret
=
ERROR_SUCCESS
;
Srs
Client
Type
type
;
Srs
RtmpConn
Type
type
;
if
((
ret
=
rtmp
->
identify_client
(
res
->
stream_id
,
type
,
req
->
stream
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"identify client failed. ret=%d"
,
ret
);
return
ret
;
...
...
@@ -262,7 +262,7 @@ int SrsClient::stream_service_cycle()
srs_assert
(
source
!=
NULL
);
// check publish available.
if
(
type
!=
Srs
Client
Play
&&
!
source
->
can_publish
())
{
if
(
type
!=
Srs
RtmpConn
Play
&&
!
source
->
can_publish
())
{
ret
=
ERROR_SYSTEM_STREAM_BUSY
;
srs_warn
(
"stream %s is already publishing. ret=%d"
,
req
->
get_stream_url
().
c_str
(),
ret
);
...
...
@@ -276,7 +276,7 @@ int SrsClient::stream_service_cycle()
source
->
set_cache
(
enabled_cache
);
switch
(
type
)
{
case
Srs
Client
Play
:
{
case
Srs
RtmpConn
Play
:
{
srs_verbose
(
"start to play stream %s."
,
req
->
stream
.
c_str
());
if
((
ret
=
rtmp
->
start_play
(
res
->
stream_id
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -292,7 +292,7 @@ int SrsClient::stream_service_cycle()
on_stop
();
return
ret
;
}
case
Srs
Client
FMLEPublish
:
{
case
Srs
RtmpConn
FMLEPublish
:
{
srs_verbose
(
"FMLE start to publish stream %s."
,
req
->
stream
.
c_str
());
if
((
ret
=
rtmp
->
start_fmle_publish
(
res
->
stream_id
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -309,7 +309,7 @@ int SrsClient::stream_service_cycle()
on_unpublish
();
return
ret
;
}
case
Srs
Client
FlashPublish
:
{
case
Srs
RtmpConn
FlashPublish
:
{
srs_verbose
(
"flash start to publish stream %s."
,
req
->
stream
.
c_str
());
if
((
ret
=
rtmp
->
start_flash_publish
(
res
->
stream_id
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -336,7 +336,7 @@ int SrsClient::stream_service_cycle()
return
ret
;
}
int
Srs
Client
::
check_vhost
()
int
Srs
RtmpConn
::
check_vhost
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -373,7 +373,7 @@ int SrsClient::check_vhost()
return
ret
;
}
int
Srs
Client
::
playing
(
SrsSource
*
source
)
int
Srs
RtmpConn
::
playing
(
SrsSource
*
source
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -462,7 +462,7 @@ int SrsClient::playing(SrsSource* source)
return
ret
;
}
int
Srs
Client
::
fmle_publish
(
SrsSource
*
source
)
int
Srs
RtmpConn
::
fmle_publish
(
SrsSource
*
source
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -531,7 +531,7 @@ int SrsClient::fmle_publish(SrsSource* source)
return
ret
;
}
int
Srs
Client
::
flash_publish
(
SrsSource
*
source
)
int
Srs
RtmpConn
::
flash_publish
(
SrsSource
*
source
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -595,7 +595,7 @@ int SrsClient::flash_publish(SrsSource* source)
return
ret
;
}
int
Srs
Client
::
process_publish_message
(
SrsSource
*
source
,
SrsCommonMessage
*
msg
)
int
Srs
RtmpConn
::
process_publish_message
(
SrsSource
*
source
,
SrsCommonMessage
*
msg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -639,7 +639,7 @@ int SrsClient::process_publish_message(SrsSource* source, SrsCommonMessage* msg)
return
ret
;
}
int
Srs
Client
::
get_peer_ip
()
int
Srs
RtmpConn
::
get_peer_ip
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -674,7 +674,7 @@ int SrsClient::get_peer_ip()
return
ret
;
}
int
Srs
Client
::
process_play_control_msg
(
SrsConsumer
*
consumer
,
SrsCommonMessage
*
msg
)
int
Srs
RtmpConn
::
process_play_control_msg
(
SrsConsumer
*
consumer
,
SrsCommonMessage
*
msg
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -722,7 +722,7 @@ int SrsClient::process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage*
return
ret
;
}
int
Srs
Client
::
on_connect
()
int
Srs
RtmpConn
::
on_connect
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -746,7 +746,7 @@ int SrsClient::on_connect()
return
ret
;
}
void
Srs
Client
::
on_close
()
void
Srs
RtmpConn
::
on_close
()
{
#ifdef SRS_HTTP_CALLBACK
// whatever the ret code, notify the api hooks.
...
...
@@ -764,7 +764,7 @@ void SrsClient::on_close()
#endif
}
int
Srs
Client
::
on_publish
()
int
Srs
RtmpConn
::
on_publish
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -788,7 +788,7 @@ int SrsClient::on_publish()
return
ret
;
}
void
Srs
Client
::
on_unpublish
()
void
Srs
RtmpConn
::
on_unpublish
()
{
#ifdef SRS_HTTP_CALLBACK
// whatever the ret code, notify the api hooks.
...
...
@@ -806,7 +806,7 @@ void SrsClient::on_unpublish()
#endif
}
int
Srs
Client
::
on_play
()
int
Srs
RtmpConn
::
on_play
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -830,7 +830,7 @@ int SrsClient::on_play()
return
ret
;
}
void
Srs
Client
::
on_stop
()
void
Srs
RtmpConn
::
on_stop
()
{
#ifdef SRS_HTTP_CALLBACK
// whatever the ret code, notify the api hooks.
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
ab3c6c9
...
...
@@ -50,7 +50,7 @@ class SrsBandwidth;
/**
* the client provides the main logic control for RTMP clients.
*/
class
Srs
Client
:
public
SrsConnection
,
public
ISrsReloadHandler
class
Srs
RtmpConn
:
public
SrsConnection
,
public
ISrsReloadHandler
{
private
:
char
*
ip
;
...
...
@@ -64,8 +64,8 @@ private:
#endif
SrsBandwidth
*
bandwidth
;
public
:
SrsClient
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
);
virtual
~
SrsClient
();
SrsRtmpConn
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
);
virtual
~
SrsRtmpConn
();
protected
:
virtual
int
do_cycle
();
// interface ISrsReloadHandler
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
ab3c6c9
...
...
@@ -296,7 +296,7 @@ int SrsServer::listen()
close_listeners
();
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
args
.
size
();
i
++
)
{
SrsListener
*
listener
=
new
SrsListener
(
this
,
SrsListenerStream
);
SrsListener
*
listener
=
new
SrsListener
(
this
,
SrsListener
Rtmp
Stream
);
listeners
.
push_back
(
listener
);
int
port
=
::
atoi
(
conf
->
args
.
at
(
i
).
c_str
());
...
...
@@ -433,8 +433,8 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
}
SrsConnection
*
conn
=
NULL
;
if
(
type
==
SrsListenerStream
)
{
conn
=
new
SrsClient
(
this
,
client_stfd
);
if
(
type
==
SrsListenerRtmpStream
)
{
conn
=
new
SrsRtmpConn
(
this
,
client_stfd
);
}
else
if
(
type
==
SrsListenerHttpApi
)
{
}
else
if
(
type
==
SrsListenerHttpStream
)
{
}
else
{
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
ab3c6c9
...
...
@@ -39,11 +39,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class
SrsServer
;
class
SrsConnection
;
// listener type for server to identify the connection,
// that is, use different type to process the connection.
enum
SrsListenerType
{
SrsListenerStream
=
0
,
SrsListenerHttpApi
,
SrsListenerHttpStream
// RTMP client,
SrsListenerRtmpStream
=
0
,
// HTTP api,
SrsListenerHttpApi
=
1
,
// HTTP stream, HDS/HLS/DASH
SrsListenerHttpStream
=
2
};
class
SrsListener
:
public
ISrsThreadHandler
...
...
trunk/src/rtmp/srs_protocol_rtmp.cpp
查看文件 @
ab3c6c9
...
...
@@ -178,12 +178,12 @@ SrsResponse::~SrsResponse()
{
}
string
srs_client_type_string
(
Srs
Client
Type
type
)
string
srs_client_type_string
(
Srs
RtmpConn
Type
type
)
{
switch
(
type
)
{
case
SrsClientPlay
:
return
"Play"
;
case
SrsClientFlashPublish
:
return
"FlashPublish"
;
case
SrsClientFMLEPublish
:
return
"FMLEPublish"
;
case
SrsRtmpConnPlay
:
return
"Play"
;
case
SrsRtmpConnFlashPublish
:
return
"FlashPublish"
;
case
SrsRtmpConnFMLEPublish
:
return
"FMLEPublish"
;
default
:
return
"Unknown"
;
}
return
"Unknown"
;
...
...
@@ -947,9 +947,9 @@ int SrsRtmpServer::on_bw_done()
return
ret
;
}
int
SrsRtmpServer
::
identify_client
(
int
stream_id
,
Srs
Client
Type
&
type
,
string
&
stream_name
)
int
SrsRtmpServer
::
identify_client
(
int
stream_id
,
Srs
RtmpConn
Type
&
type
,
string
&
stream_name
)
{
type
=
Srs
Client
Unknown
;
type
=
Srs
RtmpConn
Unknown
;
int
ret
=
ERROR_SUCCESS
;
while
(
true
)
{
...
...
@@ -1380,7 +1380,7 @@ int SrsRtmpServer::start_flash_publish(int stream_id)
return
ret
;
}
int
SrsRtmpServer
::
identify_create_stream_client
(
SrsCreateStreamPacket
*
req
,
int
stream_id
,
Srs
Client
Type
&
type
,
string
&
stream_name
)
int
SrsRtmpServer
::
identify_create_stream_client
(
SrsCreateStreamPacket
*
req
,
int
stream_id
,
Srs
RtmpConn
Type
&
type
,
string
&
stream_name
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1433,11 +1433,11 @@ int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int
return
ret
;
}
int
SrsRtmpServer
::
identify_fmle_publish_client
(
SrsFMLEStartPacket
*
req
,
Srs
Client
Type
&
type
,
string
&
stream_name
)
int
SrsRtmpServer
::
identify_fmle_publish_client
(
SrsFMLEStartPacket
*
req
,
Srs
RtmpConn
Type
&
type
,
string
&
stream_name
)
{
int
ret
=
ERROR_SUCCESS
;
type
=
Srs
Client
FMLEPublish
;
type
=
Srs
RtmpConn
FMLEPublish
;
stream_name
=
req
->
stream_name
;
// releaseStream response
...
...
@@ -1457,21 +1457,21 @@ int SrsRtmpServer::identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClie
return
ret
;
}
int
SrsRtmpServer
::
identify_flash_publish_client
(
SrsPublishPacket
*
req
,
Srs
Client
Type
&
type
,
string
&
stream_name
)
int
SrsRtmpServer
::
identify_flash_publish_client
(
SrsPublishPacket
*
req
,
Srs
RtmpConn
Type
&
type
,
string
&
stream_name
)
{
int
ret
=
ERROR_SUCCESS
;
type
=
Srs
Client
FlashPublish
;
type
=
Srs
RtmpConn
FlashPublish
;
stream_name
=
req
->
stream_name
;
return
ret
;
}
int
SrsRtmpServer
::
identify_play_client
(
SrsPlayPacket
*
req
,
Srs
Client
Type
&
type
,
string
&
stream_name
)
int
SrsRtmpServer
::
identify_play_client
(
SrsPlayPacket
*
req
,
Srs
RtmpConn
Type
&
type
,
string
&
stream_name
)
{
int
ret
=
ERROR_SUCCESS
;
type
=
Srs
Client
Play
;
type
=
Srs
RtmpConn
Play
;
stream_name
=
req
->
stream_name
;
srs_trace
(
"identity client type=play, stream_name=%s"
,
stream_name
.
c_str
());
...
...
trunk/src/rtmp/srs_protocol_rtmp.hpp
查看文件 @
ab3c6c9
...
...
@@ -101,14 +101,14 @@ struct SrsResponse
/**
* the rtmp client type.
*/
enum
Srs
Client
Type
enum
Srs
RtmpConn
Type
{
SrsClientUnknown
,
SrsClientPlay
,
SrsClientFMLEPublish
,
SrsClientFlashPublish
,
SrsRtmpConnUnknown
,
SrsRtmpConnPlay
,
SrsRtmpConnFMLEPublish
,
SrsRtmpConnFlashPublish
,
};
std
::
string
srs_client_type_string
(
Srs
Client
Type
type
);
std
::
string
srs_client_type_string
(
Srs
RtmpConn
Type
type
);
/**
* store the handshake bytes,
...
...
@@ -223,7 +223,7 @@ public:
* the stream_id used to response the createStream request.
* @type, output the client type.
*/
virtual
int
identify_client
(
int
stream_id
,
Srs
Client
Type
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_client
(
int
stream_id
,
Srs
RtmpConn
Type
&
type
,
std
::
string
&
stream_name
);
/**
* set the chunk size when client type identified.
*/
...
...
@@ -267,11 +267,11 @@ public:
*/
virtual
int
start_flash_publish
(
int
stream_id
);
private
:
virtual
int
identify_create_stream_client
(
SrsCreateStreamPacket
*
req
,
int
stream_id
,
SrsClientType
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_fmle_publish_client
(
SrsFMLEStartPacket
*
req
,
SrsClientType
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_flash_publish_client
(
SrsPublishPacket
*
req
,
SrsClientType
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_create_stream_client
(
SrsCreateStreamPacket
*
req
,
int
stream_id
,
SrsRtmpConnType
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_fmle_publish_client
(
SrsFMLEStartPacket
*
req
,
SrsRtmpConnType
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_flash_publish_client
(
SrsPublishPacket
*
req
,
SrsRtmpConnType
&
type
,
std
::
string
&
stream_name
);
private
:
virtual
int
identify_play_client
(
SrsPlayPacket
*
req
,
Srs
Client
Type
&
type
,
std
::
string
&
stream_name
);
virtual
int
identify_play_client
(
SrsPlayPacket
*
req
,
Srs
RtmpConn
Type
&
type
,
std
::
string
&
stream_name
);
};
#endif
...
...
请
注册
或
登录
后发表评论