Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
eda7a59f
Commit
eda7a59f
authored
Apr 23, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一事件参数类型
parent
b6946a59
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
69 行增加
和
41 行删除
+69
-41
api/include/mk_events.h
+1
-4
api/source/mk_events.cpp
+10
-11
api/tests/server.c
+2
-3
server/WebHook.cpp
+4
-4
src/Common/config.h
+1
-1
src/Http/HttpFileManager.cpp
+42
-5
src/Http/HttpSession.cpp
+1
-1
src/Record/HlsMediaSource.cpp
+4
-6
src/Record/HlsMediaSource.h
+2
-4
src/Rtmp/RtmpSession.cpp
+1
-1
src/Rtsp/RtspSession.cpp
+1
-1
没有找到文件。
api/include/mk_events.h
查看文件 @
eda7a59f
...
@@ -146,15 +146,12 @@ typedef struct {
...
@@ -146,15 +146,12 @@ typedef struct {
* @param total_bytes 耗费上下行总流量,单位字节数
* @param total_bytes 耗费上下行总流量,单位字节数
* @param total_seconds 本次tcp会话时长,单位秒
* @param total_seconds 本次tcp会话时长,单位秒
* @param is_player 客户端是否为播放器
* @param is_player 客户端是否为播放器
* @param peer_ip 客户端ip
* @param peer_port 客户端端口号
*/
*/
void
(
API_CALL
*
on_mk_flow_report
)(
const
mk_media_info
url_info
,
void
(
API_CALL
*
on_mk_flow_report
)(
const
mk_media_info
url_info
,
uint64_t
total_bytes
,
uint64_t
total_bytes
,
uint64_t
total_seconds
,
uint64_t
total_seconds
,
int
is_player
,
int
is_player
,
const
char
*
peer_ip
,
const
mk_sock_info
sender
);
uint16_t
peer_port
);
}
mk_events
;
}
mk_events
;
...
...
api/source/mk_events.cpp
查看文件 @
eda7a59f
...
@@ -46,7 +46,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -46,7 +46,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
s_events
.
on_mk_http_request
((
mk_parser
)
&
parser
,
s_events
.
on_mk_http_request
((
mk_parser
)
&
parser
,
(
mk_http_response_invoker
)
&
invoker
,
(
mk_http_response_invoker
)
&
invoker
,
&
consumed_int
,
&
consumed_int
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
consumed
=
consumed_int
;
consumed
=
consumed_int
;
}
}
});
});
...
@@ -57,7 +57,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -57,7 +57,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
path
.
c_str
(),
path
.
c_str
(),
is_dir
,
is_dir
,
(
mk_http_access_path_invoker
)
&
invoker
,
(
mk_http_access_path_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
else
{
}
else
{
invoker
(
""
,
""
,
0
);
invoker
(
""
,
""
,
0
);
}
}
...
@@ -69,7 +69,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -69,7 +69,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
strcpy
(
path_c
,
path
.
c_str
());
strcpy
(
path_c
,
path
.
c_str
());
s_events
.
on_mk_http_before_access
((
mk_parser
)
&
parser
,
s_events
.
on_mk_http_before_access
((
mk_parser
)
&
parser
,
path_c
,
path_c
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
path
=
path_c
;
path
=
path_c
;
}
}
});
});
...
@@ -79,7 +79,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -79,7 +79,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
if
(
s_events
.
on_mk_rtsp_get_realm
)
{
if
(
s_events
.
on_mk_rtsp_get_realm
)
{
s_events
.
on_mk_rtsp_get_realm
((
mk_media_info
)
&
args
,
s_events
.
on_mk_rtsp_get_realm
((
mk_media_info
)
&
args
,
(
mk_rtsp_get_realm_invoker
)
&
invoker
,
(
mk_rtsp_get_realm_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
else
{
}
else
{
invoker
(
""
);
invoker
(
""
);
}
}
...
@@ -92,7 +92,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -92,7 +92,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
user_name
.
c_str
(),
user_name
.
c_str
(),
must_no_encrypt
,
must_no_encrypt
,
(
mk_rtsp_auth_invoker
)
&
invoker
,
(
mk_rtsp_auth_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
}
});
});
...
@@ -100,7 +100,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -100,7 +100,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
if
(
s_events
.
on_mk_media_publish
)
{
if
(
s_events
.
on_mk_media_publish
)
{
s_events
.
on_mk_media_publish
((
mk_media_info
)
&
args
,
s_events
.
on_mk_media_publish
((
mk_media_info
)
&
args
,
(
mk_publish_auth_invoker
)
&
invoker
,
(
mk_publish_auth_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
else
{
}
else
{
GET_CONFIG
(
bool
,
toRtxp
,
General
::
kPublishToRtxp
);
GET_CONFIG
(
bool
,
toRtxp
,
General
::
kPublishToRtxp
);
GET_CONFIG
(
bool
,
toHls
,
General
::
kPublishToHls
);
GET_CONFIG
(
bool
,
toHls
,
General
::
kPublishToHls
);
...
@@ -113,7 +113,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -113,7 +113,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
if
(
s_events
.
on_mk_media_play
)
{
if
(
s_events
.
on_mk_media_play
)
{
s_events
.
on_mk_media_play
((
mk_media_info
)
&
args
,
s_events
.
on_mk_media_play
((
mk_media_info
)
&
args
,
(
mk_auth_invoker
)
&
invoker
,
(
mk_auth_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
else
{
}
else
{
invoker
(
""
);
invoker
(
""
);
}
}
...
@@ -124,7 +124,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -124,7 +124,7 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
s_events
.
on_mk_shell_login
(
user_name
.
c_str
(),
s_events
.
on_mk_shell_login
(
user_name
.
c_str
(),
passwd
.
c_str
(),
passwd
.
c_str
(),
(
mk_auth_invoker
)
&
invoker
,
(
mk_auth_invoker
)
&
invoker
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
else
{
}
else
{
invoker
(
""
);
invoker
(
""
);
}
}
...
@@ -136,15 +136,14 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
...
@@ -136,15 +136,14 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
totalBytes
,
totalBytes
,
totalDuration
,
totalDuration
,
isPlayer
,
isPlayer
,
peerIP
.
c_str
(),
(
mk_sock_info
)
&
sender
);
peerPort
);
}
}
});
});
NoticeCenter
::
Instance
().
addListener
(
&
s_tag
,
Broadcast
::
kBroadcastNotFoundStream
,[](
BroadcastNotFoundStreamArgs
){
NoticeCenter
::
Instance
().
addListener
(
&
s_tag
,
Broadcast
::
kBroadcastNotFoundStream
,[](
BroadcastNotFoundStreamArgs
){
if
(
s_events
.
on_mk_media_not_found
)
{
if
(
s_events
.
on_mk_media_not_found
)
{
s_events
.
on_mk_media_not_found
((
mk_media_info
)
&
args
,
s_events
.
on_mk_media_not_found
((
mk_media_info
)
&
args
,
(
mk_
tcp_session
)
&
sender
);
(
mk_
sock_info
)
&
sender
);
}
}
});
});
...
...
api/tests/server.c
查看文件 @
eda7a59f
...
@@ -363,8 +363,7 @@ void API_CALL on_mk_flow_report(const mk_media_info url_info,
...
@@ -363,8 +363,7 @@ void API_CALL on_mk_flow_report(const mk_media_info url_info,
uint64_t
total_bytes
,
uint64_t
total_bytes
,
uint64_t
total_seconds
,
uint64_t
total_seconds
,
int
is_player
,
int
is_player
,
const
char
*
peer_ip
,
const
mk_sock_info
sender
)
{
uint16_t
peer_port
)
{
log_printf
(
LOG_LEV
,
"%s/%s/%s/%s, url params: %s,"
log_printf
(
LOG_LEV
,
"%s/%s/%s/%s, url params: %s,"
"total_bytes: %d, total_seconds: %d, is_player: %d, peer_ip:%s, peer_port:%d"
,
"total_bytes: %d, total_seconds: %d, is_player: %d, peer_ip:%s, peer_port:%d"
,
mk_media_info_get_schema
(
url_info
),
mk_media_info_get_schema
(
url_info
),
...
@@ -372,7 +371,7 @@ void API_CALL on_mk_flow_report(const mk_media_info url_info,
...
@@ -372,7 +371,7 @@ void API_CALL on_mk_flow_report(const mk_media_info url_info,
mk_media_info_get_app
(
url_info
),
mk_media_info_get_app
(
url_info
),
mk_media_info_get_stream
(
url_info
),
mk_media_info_get_stream
(
url_info
),
mk_media_info_get_params
(
url_info
),
mk_media_info_get_params
(
url_info
),
(
int
)
total_bytes
,
(
int
)
total_seconds
,
(
int
)
is_player
,
peer_ip
,
(
int
)
peer_port
);
(
int
)
total_bytes
,
(
int
)
total_seconds
,
(
int
)
is_player
,
mk_sock_info_peer_ip
(
sender
),
(
int
)
mk_sock_info_peer_port
(
sender
)
);
}
}
static
int
flag
=
1
;
static
int
flag
=
1
;
...
...
server/WebHook.cpp
查看文件 @
eda7a59f
...
@@ -253,16 +253,16 @@ void installWebHook(){
...
@@ -253,16 +253,16 @@ void installWebHook(){
});
});
NoticeCenter
::
Instance
().
addListener
(
nullptr
,
Broadcast
::
kBroadcastFlowReport
,[](
BroadcastFlowReportArgs
){
NoticeCenter
::
Instance
().
addListener
(
nullptr
,
Broadcast
::
kBroadcastFlowReport
,[](
BroadcastFlowReportArgs
){
if
(
!
hook_enable
||
args
.
_param_strs
==
hook_adminparams
||
hook_flowreport
.
empty
()
||
peerIP
==
"127.0.0.1"
){
if
(
!
hook_enable
||
args
.
_param_strs
==
hook_adminparams
||
hook_flowreport
.
empty
()
||
sender
.
get_peer_ip
()
==
"127.0.0.1"
){
return
;
return
;
}
}
auto
body
=
make_json
(
args
);
auto
body
=
make_json
(
args
);
body
[
"totalBytes"
]
=
(
Json
::
UInt64
)
totalBytes
;
body
[
"totalBytes"
]
=
(
Json
::
UInt64
)
totalBytes
;
body
[
"duration"
]
=
(
Json
::
UInt64
)
totalDuration
;
body
[
"duration"
]
=
(
Json
::
UInt64
)
totalDuration
;
body
[
"player"
]
=
isPlayer
;
body
[
"player"
]
=
isPlayer
;
body
[
"ip"
]
=
peerIP
;
body
[
"ip"
]
=
sender
.
get_peer_ip
()
;
body
[
"port"
]
=
peerPort
;
body
[
"port"
]
=
sender
.
get_peer_port
()
;
body
[
"id"
]
=
se
ssionIdentifier
;
body
[
"id"
]
=
se
nder
.
getIdentifier
()
;
//执行hook
//执行hook
do_http_hook
(
hook_flowreport
,
body
,
nullptr
);
do_http_hook
(
hook_flowreport
,
body
,
nullptr
);
});
});
...
...
src/Common/config.h
查看文件 @
eda7a59f
...
@@ -107,7 +107,7 @@ extern const string kBroadcastShellLogin;
...
@@ -107,7 +107,7 @@ extern const string kBroadcastShellLogin;
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播
extern
const
string
kBroadcastFlowReport
;
extern
const
string
kBroadcastFlowReport
;
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer,
const string &sessionIdentifier, const string &peerIP,const uint16_t &peerPort
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer,
SockInfo &sender
//未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了
//未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了
extern
const
string
kBroadcastNotFoundStream
;
extern
const
string
kBroadcastNotFoundStream
;
...
...
src/Http/HttpFileManager.cpp
查看文件 @
eda7a59f
...
@@ -309,6 +309,39 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &mediaInfo, cons
...
@@ -309,6 +309,39 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &mediaInfo, cons
return
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastMediaPlayed
,
mediaInfo
,
mediaAuthInvoker
,
static_cast
<
SockInfo
&>
(
sender
));
return
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastMediaPlayed
,
mediaInfo
,
mediaAuthInvoker
,
static_cast
<
SockInfo
&>
(
sender
));
}
}
class
SockInfoImp
:
public
SockInfo
{
public
:
typedef
std
::
shared_ptr
<
SockInfoImp
>
Ptr
;
SockInfoImp
()
=
default
;
~
SockInfoImp
()
override
=
default
;
const
string
&
get_local_ip
()
override
{
return
_local_ip
;
}
uint16_t
get_local_port
()
override
{
return
_local_port
;
}
const
string
&
get_peer_ip
()
override
{
return
_peer_ip
;
}
uint16_t
get_peer_port
()
override
{
return
_peer_port
;
}
string
getIdentifier
()
const
override
{
return
_identifier
;
}
string
_local_ip
;
string
_peer_ip
;
string
_identifier
;
uint16_t
_local_port
;
uint16_t
_peer_port
;
};
/**
/**
* 判断http客户端是否有权限访问文件的逻辑步骤
* 判断http客户端是否有权限访问文件的逻辑步骤
...
@@ -362,12 +395,16 @@ static void canAccessPath(TcpSession &sender, const Parser &parser, const MediaI
...
@@ -362,12 +395,16 @@ static void canAccessPath(TcpSession &sender, const Parser &parser, const MediaI
}
}
bool
is_hls
=
mediaInfo
.
_schema
==
HLS_SCHEMA
;
bool
is_hls
=
mediaInfo
.
_schema
==
HLS_SCHEMA
;
string
identifier
=
sender
.
getIdentifier
();
string
peer_ip
=
sender
.
get_peer_ip
();
SockInfoImp
::
Ptr
info
=
std
::
make_shared
<
SockInfoImp
>
();
uint16_t
peer_port
=
sender
.
get_peer_port
();
info
->
_identifier
=
sender
.
getIdentifier
();
info
->
_peer_ip
=
sender
.
get_peer_ip
();
info
->
_peer_port
=
sender
.
get_peer_port
();
info
->
_local_ip
=
sender
.
get_local_ip
();
info
->
_local_port
=
sender
.
get_local_port
();
//该用户从来未获取过cookie,这个时候我们广播是否允许该用户访问该http目录
//该用户从来未获取过cookie,这个时候我们广播是否允许该用户访问该http目录
HttpSession
::
HttpAccessPathInvoker
accessPathInvoker
=
[
callback
,
uid
,
path
,
is_dir
,
is_hls
,
mediaInfo
,
i
dentifier
,
peer_ip
,
peer_port
]
HttpSession
::
HttpAccessPathInvoker
accessPathInvoker
=
[
callback
,
uid
,
path
,
is_dir
,
is_hls
,
mediaInfo
,
i
nfo
]
(
const
string
&
errMsg
,
const
string
&
cookie_path_in
,
int
cookieLifeSecond
)
{
(
const
string
&
errMsg
,
const
string
&
cookie_path_in
,
int
cookieLifeSecond
)
{
HttpServerCookie
::
Ptr
cookie
;
HttpServerCookie
::
Ptr
cookie
;
if
(
cookieLifeSecond
)
{
if
(
cookieLifeSecond
)
{
...
@@ -390,7 +427,7 @@ static void canAccessPath(TcpSession &sender, const Parser &parser, const MediaI
...
@@ -390,7 +427,7 @@ static void canAccessPath(TcpSession &sender, const Parser &parser, const MediaI
attachment
.
_is_hls
=
is_hls
;
attachment
.
_is_hls
=
is_hls
;
if
(
is_hls
){
if
(
is_hls
){
//hls相关信息
//hls相关信息
attachment
.
_hls_data
=
std
::
make_shared
<
HlsCookieData
>
(
mediaInfo
,
i
dentifier
,
peer_ip
,
peer_port
);
attachment
.
_hls_data
=
std
::
make_shared
<
HlsCookieData
>
(
mediaInfo
,
i
nfo
);
//hls未查找MediaSource
//hls未查找MediaSource
attachment
.
_have_find_media_source
=
false
;
attachment
.
_have_find_media_source
=
false
;
}
}
...
...
src/Http/HttpSession.cpp
查看文件 @
eda7a59f
...
@@ -108,7 +108,7 @@ void HttpSession::onError(const SockException& err) {
...
@@ -108,7 +108,7 @@ void HttpSession::onError(const SockException& err) {
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
true
,
getIdentifier
(),
get_peer_ip
(),
get_peer_port
(
));
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
true
,
static_cast
<
SockInfo
&>
(
*
this
));
}
}
return
;
return
;
}
}
...
...
src/Record/HlsMediaSource.cpp
查看文件 @
eda7a59f
...
@@ -12,11 +12,9 @@
...
@@ -12,11 +12,9 @@
namespace
mediakit
{
namespace
mediakit
{
HlsCookieData
::
HlsCookieData
(
const
MediaInfo
&
info
,
const
st
ring
&
sessionIdentifier
,
const
string
&
peer_ip
,
uint16_t
peer_port
)
{
HlsCookieData
::
HlsCookieData
(
const
MediaInfo
&
info
,
const
st
d
::
shared_ptr
<
SockInfo
>
&
sock_info
)
{
_info
=
info
;
_info
=
info
;
_sessionIdentifier
=
sessionIdentifier
;
_sock_info
=
sock_info
;
_peer_ip
=
peer_ip
;
_peer_port
=
peer_port
;
_added
=
std
::
make_shared
<
bool
>
(
false
);
_added
=
std
::
make_shared
<
bool
>
(
false
);
addReaderCount
();
addReaderCount
();
}
}
...
@@ -45,13 +43,13 @@ HlsCookieData::~HlsCookieData() {
...
@@ -45,13 +43,13 @@ HlsCookieData::~HlsCookieData() {
src
->
modifyReaderCount
(
false
);
src
->
modifyReaderCount
(
false
);
}
}
uint64_t
duration
=
(
_ticker
.
createdTime
()
-
_ticker
.
elapsedTime
())
/
1000
;
uint64_t
duration
=
(
_ticker
.
createdTime
()
-
_ticker
.
elapsedTime
())
/
1000
;
WarnL
<<
_s
essionIdentifier
<<
"("
<<
_peer_ip
<<
":"
<<
_peer_port
<<
") "
WarnL
<<
_s
ock_info
->
getIdentifier
()
<<
"("
<<
_sock_info
->
get_peer_ip
()
<<
":"
<<
_sock_info
->
get_peer_port
()
<<
") "
<<
"HLS播放器("
<<
_info
.
_vhost
<<
"/"
<<
_info
.
_app
<<
"/"
<<
_info
.
_streamid
<<
"HLS播放器("
<<
_info
.
_vhost
<<
"/"
<<
_info
.
_app
<<
"/"
<<
_info
.
_streamid
<<
")断开,耗时(s):"
<<
duration
;
<<
")断开,耗时(s):"
<<
duration
;
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
if
(
_bytes
>
iFlowThreshold
*
1024
)
{
if
(
_bytes
>
iFlowThreshold
*
1024
)
{
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_info
,
_bytes
,
duration
,
true
,
_sessionIdentifier
,
_peer_ip
,
_peer_port
);
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_info
,
_bytes
,
duration
,
true
,
static_cast
<
SockInfo
&>
(
*
_sock_info
)
);
}
}
}
}
}
}
...
...
src/Record/HlsMediaSource.h
查看文件 @
eda7a59f
...
@@ -77,7 +77,7 @@ private:
...
@@ -77,7 +77,7 @@ private:
class
HlsCookieData
{
class
HlsCookieData
{
public
:
public
:
typedef
std
::
shared_ptr
<
HlsCookieData
>
Ptr
;
typedef
std
::
shared_ptr
<
HlsCookieData
>
Ptr
;
HlsCookieData
(
const
MediaInfo
&
info
,
const
st
ring
&
sessionIdentifier
,
const
string
&
peer_ip
,
uint16_t
peer_port
);
HlsCookieData
(
const
MediaInfo
&
info
,
const
st
d
::
shared_ptr
<
SockInfo
>
&
sock_info
);
~
HlsCookieData
();
~
HlsCookieData
();
void
addByteUsage
(
uint64_t
bytes
);
void
addByteUsage
(
uint64_t
bytes
);
private
:
private
:
...
@@ -85,12 +85,10 @@ private:
...
@@ -85,12 +85,10 @@ private:
private
:
private
:
uint64_t
_bytes
=
0
;
uint64_t
_bytes
=
0
;
MediaInfo
_info
;
MediaInfo
_info
;
string
_sessionIdentifier
;
string
_peer_ip
;
uint16_t
_peer_port
;
std
::
shared_ptr
<
bool
>
_added
;
std
::
shared_ptr
<
bool
>
_added
;
weak_ptr
<
HlsMediaSource
>
_src
;
weak_ptr
<
HlsMediaSource
>
_src
;
Ticker
_ticker
;
Ticker
_ticker
;
std
::
shared_ptr
<
SockInfo
>
_sock_info
;
HlsMediaSource
::
RingType
::
RingReader
::
Ptr
_ring_reader
;
HlsMediaSource
::
RingType
::
RingReader
::
Ptr
_ring_reader
;
};
};
...
...
src/Rtmp/RtmpSession.cpp
查看文件 @
eda7a59f
...
@@ -39,7 +39,7 @@ void RtmpSession::onError(const SockException& err) {
...
@@ -39,7 +39,7 @@ void RtmpSession::onError(const SockException& err) {
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
isPlayer
,
getIdentifier
(),
get_peer_ip
(),
get_peer_port
(
));
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
isPlayer
,
static_cast
<
SockInfo
&>
(
*
this
));
}
}
}
}
...
...
src/Rtsp/RtspSession.cpp
查看文件 @
eda7a59f
...
@@ -92,7 +92,7 @@ void RtspSession::onError(const SockException& err) {
...
@@ -92,7 +92,7 @@ void RtspSession::onError(const SockException& err) {
//流量统计事件广播
//流量统计事件广播
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
GET_CONFIG
(
uint32_t
,
iFlowThreshold
,
General
::
kFlowThreshold
);
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
if
(
_ui64TotalBytes
>
iFlowThreshold
*
1024
){
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
isPlayer
,
getIdentifier
(),
get_peer_ip
(),
get_peer_port
(
));
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastFlowReport
,
_mediaInfo
,
_ui64TotalBytes
,
duration
,
isPlayer
,
static_cast
<
SockInfo
&>
(
*
this
));
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论