winlin

for #381, refine the hls notify, report one by one.

@@ -794,6 +794,7 @@ vhost hooks.callback.srs.com { @@ -794,6 +794,7 @@ vhost hooks.callback.srs.com {
794 # [stream], replace with the stream. 794 # [stream], replace with the stream.
795 # [ts_url], replace with the ts url. 795 # [ts_url], replace with the ts url.
796 # ignore any return data of server. 796 # ignore any return data of server.
  797 + # @remark random select a url to report, not report all.
797 on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url]; 798 on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url];
798 } 799 }
799 } 800 }
@@ -240,13 +240,17 @@ int SrsDvrAsyncCallOnHlsNotify::call() @@ -240,13 +240,17 @@ int SrsDvrAsyncCallOnHlsNotify::call()
240 return ret; 240 return ret;
241 } 241 }
242 242
  243 + std::string url;
  244 + if (true) {
  245 + static u_int32_t nb_call = 0;
  246 + int index = nb_call++ % on_hls->args.size();
  247 + url = on_hls->args.at(index);
  248 + }
  249 +
243 int nb_notify = _srs_config->get_vhost_hls_nb_notify(req->vhost); 250 int nb_notify = _srs_config->get_vhost_hls_nb_notify(req->vhost);
244 - for (int i = 0; i < (int)on_hls->args.size(); i++) {  
245 - std::string url = on_hls->args.at(i);  
246 - if ((ret = SrsHttpHooks::on_hls_notify(url, req, ts_url, nb_notify)) != ERROR_SUCCESS) {  
247 - srs_error("hook client on_hls_notify failed. url=%s, ts=%s, ret=%d", url.c_str(), ts_url.c_str(), ret);  
248 - return ret;  
249 - } 251 + if ((ret = SrsHttpHooks::on_hls_notify(url, req, ts_url, nb_notify)) != ERROR_SUCCESS) {
  252 + srs_error("hook client on_hls_notify failed. url=%s, ts=%s, ret=%d", url.c_str(), ts_url.c_str(), ret);
  253 + return ret;
250 } 254 }
251 } 255 }
252 #endif 256 #endif