Merge branch 'master' into patch-72
This commit is contained in:
commit
c379bbab82
|
|
@ -540,7 +540,7 @@ void getStatisticJson(const function<void(Value &val)> &cb) {
|
|||
}
|
||||
|
||||
void addStreamProxy(const string &vhost, const string &app, const string &stream, const string &url, int retry_count,
|
||||
const ProtocolOption &option, int rtp_type, float timeout_sec,
|
||||
const ProtocolOption &option, int rtp_type, float timeout_sec, const mINI &args,
|
||||
const function<void(const SockException &ex, const string &key)> &cb) {
|
||||
auto key = getProxyKey(vhost, app, stream);
|
||||
lock_guard<recursive_mutex> lck(s_proxyMapMtx);
|
||||
|
|
@ -575,6 +575,7 @@ void addStreamProxy(const string &vhost, const string &app, const string &stream
|
|||
lock_guard<recursive_mutex> lck(s_proxyMapMtx);
|
||||
s_proxyMap.erase(key);
|
||||
});
|
||||
player->mINI::operator=(args);
|
||||
player->play(url);
|
||||
};
|
||||
|
||||
|
|
@ -1058,6 +1059,11 @@ void installWebApi() {
|
|||
CHECK_SECRET();
|
||||
CHECK_ARGS("vhost","app","stream","url");
|
||||
|
||||
mINI args;
|
||||
for (auto &pr : allArgs.getArgs()) {
|
||||
args.emplace(pr.first, pr.second);
|
||||
}
|
||||
|
||||
ProtocolOption option(allArgs);
|
||||
auto retry_count = allArgs["retry_count"].empty()? -1: allArgs["retry_count"].as<int>();
|
||||
addStreamProxy(allArgs["vhost"],
|
||||
|
|
@ -1068,6 +1074,7 @@ void installWebApi() {
|
|||
option,
|
||||
allArgs["rtp_type"],
|
||||
allArgs["timeout_sec"],
|
||||
args,
|
||||
[invoker,val,headerOut](const SockException &ex,const string &key) mutable{
|
||||
if (ex) {
|
||||
val["code"] = API::OtherFailed;
|
||||
|
|
@ -1891,6 +1898,7 @@ void installWebApi() {
|
|||
option,
|
||||
0,//rtp over tcp方式拉流
|
||||
10,//10秒超时
|
||||
mINI{},
|
||||
[invoker,val,headerOut](const SockException &ex,const string &key) mutable{
|
||||
if(ex){
|
||||
val["code"] = API::OtherFailed;
|
||||
|
|
|
|||
|
|
@ -247,6 +247,6 @@ bool closeRtpServer(const std::string &stream_id);
|
|||
Json::Value makeMediaSourceJson(mediakit::MediaSource &media);
|
||||
void getStatisticJson(const std::function<void(Json::Value &val)> &cb);
|
||||
void addStreamProxy(const std::string &vhost, const std::string &app, const std::string &stream, const std::string &url, int retry_count,
|
||||
const mediakit::ProtocolOption &option, int rtp_type, float timeout_sec,
|
||||
const mediakit::ProtocolOption &option, int rtp_type, float timeout_sec, const toolkit::mINI &args,
|
||||
const std::function<void(const toolkit::SockException &ex, const std::string &key)> &cb);
|
||||
#endif //ZLMEDIAKIT_WEBAPI_H
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ static void pullStreamFromOrigin(const vector<string> &urls, size_t index, size_
|
|||
option.enable_hls = option.enable_hls || (args.schema == HLS_SCHEMA);
|
||||
option.enable_mp4 = false;
|
||||
|
||||
addStreamProxy(args.vhost, args.app, args.stream, url, retry_count, option, Rtsp::RTP_TCP, timeout_sec, [=](const SockException &ex, const string &key) mutable {
|
||||
addStreamProxy(args.vhost, args.app, args.stream, url, retry_count, option, Rtsp::RTP_TCP, timeout_sec, mINI{}, [=](const SockException &ex, const string &key) mutable {
|
||||
if (!ex) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,15 +82,17 @@ void HttpClient::sendRequest(const string &url) {
|
|||
printer.pop_back();
|
||||
_header.emplace("Cookie", printer);
|
||||
}
|
||||
if (isUsedProxy()) {
|
||||
startConnect(_proxy_host, _proxy_port, _wait_header_ms / 1000.0f);
|
||||
} else {
|
||||
if (!alive() || host_changed || !_http_persistent) {
|
||||
startConnect(host, port, _wait_header_ms / 1000.0f);
|
||||
|
||||
if (!alive() || host_changed) {
|
||||
if (isUsedProxy()) {
|
||||
_proxy_connected = false;
|
||||
startConnect(_proxy_host, _proxy_port, _wait_header_ms / 1000.0f);
|
||||
} else {
|
||||
SockException ex;
|
||||
onConnect_l(ex);
|
||||
startConnect(host, port, _wait_header_ms / 1000.0f);
|
||||
}
|
||||
} else {
|
||||
SockException ex;
|
||||
onConnect_l(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue