diff --git a/server/WebHook.cpp b/server/WebHook.cpp index 2c91393f..764aa4db 100644 --- a/server/WebHook.cpp +++ b/server/WebHook.cpp @@ -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); }); diff --git a/src/Common/config.h b/src/Common/config.h index d96cc0ec..034fba05 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -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[]; diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 3fe4e1b5..72a2065c 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -164,6 +164,7 @@ void HttpSession::onError(const SockException& err) { _mediaInfo, _ui64TotalBytes, _ticker.createdTime()/1000, + true, *this); } } diff --git a/src/Rtmp/RtmpSession.cpp b/src/Rtmp/RtmpSession.cpp index 772e8e6c..95d6ab4b 100644 --- a/src/Rtmp/RtmpSession.cpp +++ b/src/Rtmp/RtmpSession.cpp @@ -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); } } diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index a3f1e3de..2ec4179c 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -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); }