流量统计添加isPlayer参数

This commit is contained in:
xiongziliang 2019-05-20 17:46:06 +08:00
parent f9f487bf61
commit fbead02868
5 changed files with 7 additions and 1 deletions

View File

@ -199,6 +199,7 @@ void installWebHook(){
body["id"] = sender.getIdentifier();
body["totalBytes"] = (Json::UInt64)totalBytes;
body["duration"] = (Json::UInt64)totalDuration;
body["player"] = isPlayer;
//执行hook
do_http_hook(hook_flowreport,body, nullptr);
});

View File

@ -110,7 +110,7 @@ extern const char kBroadcastShellLogin[];
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播
extern const char kBroadcastFlowReport[];
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,TcpSession &sender
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer,TcpSession &sender
//未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了
extern const char kBroadcastNotFoundStream[];

View File

@ -164,6 +164,7 @@ void HttpSession::onError(const SockException& err) {
_mediaInfo,
_ui64TotalBytes,
_ticker.createdTime()/1000,
true,
*this);
}
}

View File

@ -56,10 +56,12 @@ void RtmpSession::onError(const SockException& err) {
GET_CONFIG_AND_REGISTER(uint32_t,iFlowThreshold,Broadcast::kFlowThreshold);
if(_ui64TotalBytes > iFlowThreshold * 1024){
bool isPlayer = !_pPublisherSrc;
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport,
_mediaInfo,
_ui64TotalBytes,
_ticker.createdTime()/1000,
isPlayer,
*this);
}
}

View File

@ -99,10 +99,12 @@ void RtspSession::onError(const SockException& err) {
//流量统计事件广播
GET_CONFIG_AND_REGISTER(uint32_t,iFlowThreshold,Broadcast::kFlowThreshold);
if(_ui64TotalBytes > iFlowThreshold * 1024){
bool isPlayer = !_pushSrc;
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport,
_mediaInfo,
_ui64TotalBytes,
_ticker.createdTime()/1000,
isPlayer,
*this);
}