1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix #274: http-callback support on_dvr when reap a dvr file. 2.0.89

This commit is contained in:
winlin 2015-01-03 15:33:23 +08:00
parent dd2c7e0b4d
commit dc11418c79
12 changed files with 207 additions and 7 deletions

View file

@ -404,6 +404,30 @@ int SrsDvrPlan::flv_close()
return ret;
}
#ifdef SRS_AUTO_HTTP_CALLBACK
SrsRequest* req = _req;
if (_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
// HTTP: on_dvr
SrsConfDirective* on_dvr = _srs_config->get_vhost_on_dvr(req->vhost);
if (!on_dvr) {
srs_info("ignore the empty http callback: on_dvr");
return ret;
}
int connection_id = _srs_context->get_id();
std::string ip = req->ip;
std::string cwd = _srs_config->cwd();
std::string file = segment->path;
for (int i = 0; i < (int)on_dvr->args.size(); i++) {
std::string url = on_dvr->args.at(i);
if ((ret = SrsHttpHooks::on_dvr(url, connection_id, ip, req, cwd, file)) != ERROR_SUCCESS) {
srs_error("hook client on_dvr failed. url=%s, ret=%d", url.c_str(), ret);
return ret;
}
}
}
#endif
return ret;
}