diff --git a/c_wrapper/.idea/workspace.xml b/c_wrapper/.idea/workspace.xml
index 4b6cc373..928069e8 100644
--- a/c_wrapper/.idea/workspace.xml
+++ b/c_wrapper/.idea/workspace.xml
@@ -2,18 +2,27 @@
-
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
@@ -22,27 +31,17 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
+
+
+
@@ -50,73 +49,52 @@
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
-
-
+
+
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -124,23 +102,45 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
s_threadPool
+ 11
+ s_mapPlayer
+
+
+
@@ -173,23 +174,13 @@
DEFINITION_ORDER
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -197,23 +188,29 @@
-
+
+
+
+
+
+
-
+
+
-
-
-
+
+
+
@@ -239,28 +236,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -270,34 +261,35 @@
1513153608354
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -331,94 +323,114 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
-
-
+
-
-
+
@@ -426,99 +438,156 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/test_server.cpp b/tests/test_server.cpp
index fdcc873b..45589be5 100644
--- a/tests/test_server.cpp
+++ b/tests/test_server.cpp
@@ -106,6 +106,7 @@ onceToken token1([](){
#define REALM "realm_zlmedaikit"
static onceToken s_token([](){
+ //监听kBroadcastOnGetRtspRealm事件决定rtsp链接是否需要鉴权(传统的rtsp鉴权方案)才能访问
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastOnGetRtspRealm,[](BroadcastOnGetRtspRealmArgs){
if(string("1") == args._streamid ){
// live/1需要认证
@@ -123,6 +124,7 @@ static onceToken s_token([](){
}
});
+ //监听kBroadcastOnRtspAuth事件返回正确的rtsp鉴权用户密码
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastOnRtspAuth,[](BroadcastOnRtspAuthArgs){
InfoL << "用户:" << user_name << (must_no_encrypt ? " Base64" : " MD5" )<< " 方式登录";
string user = user_name;
@@ -153,7 +155,8 @@ static onceToken s_token([](){
});
- NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastRtmpPublish,[](BroadcastRtmpPublishArgs){
+ //监听rtsp/rtmp推流事件,返回结果告知是否有推流权限
+ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){
InfoL << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ;
EventPoller::Instance().async([invoker](){
invoker("");//鉴权成功
@@ -161,6 +164,7 @@ static onceToken s_token([](){
});
});
+ //监听rtsp/rtsps/rtmp/http-flv播放事件,返回结果告知是否有播放权限(rtsp通过kBroadcastOnRtspAuth或此事件都可以实现鉴权)
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPlayed,[](BroadcastMediaPlayedArgs){
InfoL << args._schema << " " << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ;
EventPoller::Instance().async([invoker](){
@@ -169,6 +173,7 @@ static onceToken s_token([](){
});
});
+ //shell登录事件,通过shell可以登录进服务器执行一些命令
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastShellLogin,[](BroadcastShellLoginArgs){
InfoL << "shell login:" << user_name << " " << passwd;
EventPoller::Instance().async([invoker](){
@@ -177,7 +182,7 @@ static onceToken s_token([](){
});
});
- //此处用于测试rtmp保存为flv录像,保存在http根目录下
+ //监听rtsp、rtmp源注册或注销事件;此处用于测试rtmp保存为flv录像,保存在http根目录下
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaChanged,[](BroadcastMediaChangedArgs){
if(schema == RTMP_SCHEMA && app == "live"){
static map s_mapFlvRecorder;
@@ -199,6 +204,23 @@ static onceToken s_token([](){
}
});
+ //监听播放失败(未找到特定的流)事件
+ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastNotFoundStream,[](BroadcastNotFoundStreamArgs){
+ /**
+ * 你可以在这个事件触发时再去拉流,这样就可以实现按需拉流
+ * 拉流成功后,ZLMediaKit会把其立即转发给播放器(最大等待时间约为5秒,如果5秒都未拉流成功,播放器会播放失败)
+ */
+ DebugL << "未找到流:" << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs ;
+ });
+
+
+ //监听播放或推流结束时消耗流量事件
+ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastFlowReport,[](BroadcastFlowReportArgs){
+ DebugL << "播放器(推流器)断开连接:" << args._vhost << " " << args._app << " " << args._streamid << " " << args._param_strs
+ << "\r\n使用流量:" << totalBytes << " bytes,连接时长:" << totalDuration << "秒" ;
+
+ });
+
}, nullptr);