Commit 5258169a by xiongziliang

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

parent 09a2623e
...@@ -211,10 +211,10 @@ void installWebHook(){ ...@@ -211,10 +211,10 @@ void installWebHook(){
GET_CONFIG(string,hook_http_access,Hook::kOnHttpAccess); GET_CONFIG(string,hook_http_access,Hook::kOnHttpAccess);
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastMediaPublish,[](BroadcastMediaPublishArgs){ 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"){ 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); invoker("",toRtxp,toHls,toMP4);
return; return;
} }
...@@ -227,24 +227,20 @@ void installWebHook(){ ...@@ -227,24 +227,20 @@ void installWebHook(){
do_http_hook(hook_publish,body,[invoker](const Value &obj,const string &err){ do_http_hook(hook_publish,body,[invoker](const Value &obj,const string &err){
if(err.empty()){ if(err.empty()){
//推流鉴权成功 //推流鉴权成功
bool enableRtxp = true;
bool enableHls = true;
bool enableMP4 = false;
//兼容用户不传递enableRtxp、enableHls、enableMP4参数 //兼容用户不传递enableRtxp、enableHls、enableMP4参数
if(obj.isMember("enableRtxp")){ if(obj.isMember("enableRtxp")){
enableRtxp = obj["enableRtxp"].asBool(); toRtxp = obj["enableRtxp"].asBool();
} }
if(obj.isMember("enableHls")){ if(obj.isMember("enableHls")){
enableHls = obj["enableHls"].asBool(); toHls = obj["enableHls"].asBool();
} }
if(obj.isMember("enableMP4")){ if(obj.isMember("enableMP4")){
enableMP4 = obj["enableMP4"].asBool(); toMP4 = obj["enableMP4"].asBool();
} }
invoker(err,enableRtxp,enableHls,enableMP4); invoker(err,toRtxp,toHls,toMP4);
}else{ }else{
//推流鉴权失败 //推流鉴权失败
invoker(err,false, false, false); invoker(err,false, false, false);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论