mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #381, refine the hls notify, report one by one.
This commit is contained in:
parent
a4216cc582
commit
02a2cb7e1a
2 changed files with 11 additions and 6 deletions
|
@ -794,6 +794,7 @@ vhost hooks.callback.srs.com {
|
|||
# [stream], replace with the stream.
|
||||
# [ts_url], replace with the ts url.
|
||||
# ignore any return data of server.
|
||||
# @remark random select a url to report, not report all.
|
||||
on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,13 +240,17 @@ int SrsDvrAsyncCallOnHlsNotify::call()
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string url;
|
||||
if (true) {
|
||||
static u_int32_t nb_call = 0;
|
||||
int index = nb_call++ % on_hls->args.size();
|
||||
url = on_hls->args.at(index);
|
||||
}
|
||||
|
||||
int nb_notify = _srs_config->get_vhost_hls_nb_notify(req->vhost);
|
||||
for (int i = 0; i < (int)on_hls->args.size(); i++) {
|
||||
std::string url = on_hls->args.at(i);
|
||||
if ((ret = SrsHttpHooks::on_hls_notify(url, req, ts_url, nb_notify)) != ERROR_SUCCESS) {
|
||||
srs_error("hook client on_hls_notify failed. url=%s, ts=%s, ret=%d", url.c_str(), ts_url.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
if ((ret = SrsHttpHooks::on_hls_notify(url, req, ts_url, nb_notify)) != ERROR_SUCCESS) {
|
||||
srs_error("hook client on_hls_notify failed. url=%s, ts=%s, ret=%d", url.c_str(), ts_url.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue