From fbead02868c151ad6bf5b99c68a600540c00290c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 20 May 2019 17:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E9=87=8F=E7=BB=9F=E8=AE=A1=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0isPlayer=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebHook.cpp | 1 + src/Common/config.h | 2 +- src/Http/HttpSession.cpp | 1 + src/Rtmp/RtmpSession.cpp | 2 ++ src/Rtsp/RtspSession.cpp | 2 ++ 5 files changed, 7 insertions(+), 1 deletion(-) 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); }