Commit 728dd3ec by xiongziliang

合并pr:#509

parent eccb1a66
...@@ -197,8 +197,7 @@ void FFmpegSource::startTimer(int timeout_ms) { ...@@ -197,8 +197,7 @@ void FFmpegSource::startTimer(int timeout_ms) {
strongSelf->findAsync(0, [&](const MediaSource::Ptr &src) { strongSelf->findAsync(0, [&](const MediaSource::Ptr &src) {
//同步查找流 //同步查找流
if (!src) { if (!src) {
//流不在线,重新拉流 //流不在线,重新拉流, 这里原先是10秒超时,实际发现10秒不够,改成20秒了
//@子悦,这里原先是10秒超时,实际发现10秒不够,我改成20秒了
if(strongSelf->_replay_ticker.elapsedTime() > 20 * 1000){ if(strongSelf->_replay_ticker.elapsedTime() > 20 * 1000){
//上次重试时间超过10秒,那么再重试FFmpeg拉流 //上次重试时间超过10秒,那么再重试FFmpeg拉流
strongSelf->_replay_ticker.resetTime(); strongSelf->_replay_ticker.resetTime();
......
...@@ -129,6 +129,9 @@ const char *getContentType(const HttpArgs &value){ ...@@ -129,6 +129,9 @@ const char *getContentType(const HttpArgs &value){
} }
static void do_http_hook(const string &url,const ArgsType &body,const function<void(const Value &,const string &)> &fun){ static void do_http_hook(const string &url,const ArgsType &body,const function<void(const Value &,const string &)> &fun){
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
const_cast<ArgsType &>(body)["mediaserverid"] = mediaServerId;
GET_CONFIG(float,hook_timeoutSec,Hook::kTimeoutSec); GET_CONFIG(float,hook_timeoutSec,Hook::kTimeoutSec);
HttpRequester::Ptr requester(new HttpRequester); HttpRequester::Ptr requester(new HttpRequester);
requester->setMethod("POST"); requester->setMethod("POST");
...@@ -158,8 +161,6 @@ static void do_http_hook(const string &url,const ArgsType &body,const function<v ...@@ -158,8 +161,6 @@ static void do_http_hook(const string &url,const ArgsType &body,const function<v
static ArgsType make_json(const MediaInfo &args){ static ArgsType make_json(const MediaInfo &args){
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["schema"] = args._schema; body["schema"] = args._schema;
body["vhost"] = args._vhost; body["vhost"] = args._vhost;
body["app"] = args._app; body["app"] = args._app;
...@@ -321,8 +322,6 @@ void installWebHook(){ ...@@ -321,8 +322,6 @@ void installWebHook(){
return; return;
} }
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["regist"] = bRegist; body["regist"] = bRegist;
body["schema"] = sender.getSchema(); body["schema"] = sender.getSchema();
body["vhost"] = sender.getVhost(); body["vhost"] = sender.getVhost();
...@@ -348,8 +347,6 @@ void installWebHook(){ ...@@ -348,8 +347,6 @@ void installWebHook(){
static auto getRecordInfo = [](const RecordInfo &info) { static auto getRecordInfo = [](const RecordInfo &info) {
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["start_time"] = (Json::UInt64) info.start_time; body["start_time"] = (Json::UInt64) info.start_time;
body["file_size"] = (Json::UInt64) info.file_size; body["file_size"] = (Json::UInt64) info.file_size;
body["time_len"] = info.time_len; body["time_len"] = info.time_len;
...@@ -388,8 +385,6 @@ void installWebHook(){ ...@@ -388,8 +385,6 @@ void installWebHook(){
return; return;
} }
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["ip"] = sender.get_peer_ip(); body["ip"] = sender.get_peer_ip();
body["port"] = sender.get_peer_port(); body["port"] = sender.get_peer_port();
body["id"] = sender.getIdentifier(); body["id"] = sender.getIdentifier();
...@@ -408,8 +403,6 @@ void installWebHook(){ ...@@ -408,8 +403,6 @@ void installWebHook(){
} }
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["schema"] = sender.getSchema(); body["schema"] = sender.getSchema();
body["vhost"] = sender.getVhost(); body["vhost"] = sender.getVhost();
body["app"] = sender.getApp(); body["app"] = sender.getApp();
...@@ -455,8 +448,6 @@ void installWebHook(){ ...@@ -455,8 +448,6 @@ void installWebHook(){
} }
ArgsType body; ArgsType body;
GET_CONFIG(string,mediaServerId,General::kMediaServerId);
body["mediaserverid"] = mediaServerId;
body["ip"] = sender.get_peer_ip(); body["ip"] = sender.get_peer_ip();
body["port"] = sender.get_peer_port(); body["port"] = sender.get_peer_port();
body["id"] = sender.getIdentifier(); body["id"] = sender.getIdentifier();
......
...@@ -18,25 +18,6 @@ ...@@ -18,25 +18,6 @@
using namespace toolkit; using namespace toolkit;
namespace mediakit { namespace mediakit {
string generalGuid() {
srand(time(0));
std::string random_str("");
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 8; j++)
switch (rand() % 2) {
case 1:
random_str += ('A' + rand() % 26);
break;
default:
random_str += ('0' + rand() % 10);
break;
}
if (i < 5)
random_str += "-";
}
return random_str;
}
bool loadIniConfig(const char *ini_path){ bool loadIniConfig(const char *ini_path){
string ini; string ini;
...@@ -100,7 +81,7 @@ onceToken token([](){ ...@@ -100,7 +81,7 @@ onceToken token([](){
mINI::Instance()[kPublishToMP4] = 0; mINI::Instance()[kPublishToMP4] = 0;
mINI::Instance()[kMergeWriteMS] = 0; mINI::Instance()[kMergeWriteMS] = 0;
mINI::Instance()[kModifyStamp] = 0; mINI::Instance()[kModifyStamp] = 0;
mINI::Instance()[kMediaServerId] = generalGuid(); mINI::Instance()[kMediaServerId] = makeRandStr(16);
},nullptr); },nullptr);
}//namespace General }//namespace General
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论