修复协议转换配置开关不生效的bug

This commit is contained in:
xiongziliang 2020-01-07 15:37:48 +08:00
parent 09a2623e1b
commit 5258169a07

View File

@ -211,10 +211,10 @@ void installWebHook(){
GET_CONFIG(string,hook_http_access,Hook::kOnHttpAccess);
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){
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);
if(!hook_enable || args._param_strs == hook_adminparams || hook_publish.empty() || sender.get_peer_ip() == "127.0.0.1"){
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);