From 02a2cb7e1a3b9f2b049eabc4fa2b115091af563f Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 14 Apr 2015 11:36:58 +0800 Subject: [PATCH] for #381, refine the hls notify, report one by one. --- trunk/conf/full.conf | 1 + trunk/src/app/srs_app_hls.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index ed31509bd..b0c883939 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -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]; } } diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 49e8762e2..2a2387b7c 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -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