diff --git a/server/WebHook.cpp b/server/WebHook.cpp index b28a5844..6e0605bf 100644 --- a/server/WebHook.cpp +++ b/server/WebHook.cpp @@ -211,10 +211,10 @@ void installWebHook(){ GET_CONFIG(string,hook_http_access,Hook::kOnHttpAccess); NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){ + GET_CONFIG(bool,toRtxp,General::kPublishToRtxp); + GET_CONFIG(bool,toHls,General::kPublishToHls); + GET_CONFIG(bool,toMP4,General::kPublishToMP4); if(!hook_enable || args._param_strs == hook_adminparams || hook_publish.empty() || sender.get_peer_ip() == "127.0.0.1"){ - GET_CONFIG(bool,toRtxp,General::kPublishToRtxp); - GET_CONFIG(bool,toHls,General::kPublishToHls); - GET_CONFIG(bool,toMP4,General::kPublishToMP4); invoker("",toRtxp,toHls,toMP4); return; } @@ -227,24 +227,20 @@ void installWebHook(){ do_http_hook(hook_publish,body,[invoker](const Value &obj,const string &err){ if(err.empty()){ //推流鉴权成功 - bool enableRtxp = true; - bool enableHls = true; - bool enableMP4 = false; - //兼容用户不传递enableRtxp、enableHls、enableMP4参数 if(obj.isMember("enableRtxp")){ - enableRtxp = obj["enableRtxp"].asBool(); + toRtxp = obj["enableRtxp"].asBool(); } if(obj.isMember("enableHls")){ - enableHls = obj["enableHls"].asBool(); + toHls = obj["enableHls"].asBool(); } if(obj.isMember("enableMP4")){ - enableMP4 = obj["enableMP4"].asBool(); + toMP4 = obj["enableMP4"].asBool(); } - invoker(err,enableRtxp,enableHls,enableMP4); + invoker(err,toRtxp,toHls,toMP4); }else{ //推流鉴权失败 invoker(err,false, false, false);