实现hls的流量汇报事件

This commit is contained in:
xiongziliang
2019-12-29 15:38:29 +08:00
parent e951efc615
commit e91c26c052
11 changed files with 91 additions and 78 deletions

View File

@@ -269,16 +269,20 @@ void installWebHook(){
});
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastFlowReport,[](BroadcastFlowReportArgs){
if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty() || sender.get_peer_ip() == "127.0.0.1"){
if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty()){
return;
}
auto body = make_json(args);
body["ip"] = sender.get_peer_ip();
body["port"] = sender.get_peer_port();
body["id"] = sender.getIdentifier();
body["totalBytes"] = (Json::UInt64)totalBytes;
body["duration"] = (Json::UInt64)totalDuration;
body["player"] = isPlayer;
body["schema"] = args._schema;
body["vhost"] = args._vhost;
body["app"] = args._app;
body["stream"] = args._streamid;
body["params"] = args._param_strs;
//执行hook
do_http_hook(hook_flowreport,body, nullptr);
});